Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling sass with npm scripts - node-sass returns EISDIR: illegal operation on a directory

Following this writeup I am trying to write a script to compile my sass into css using node-sass.

This is my package.json scripts part:

  "scripts" : {
    "prestart" : "babel-node tools/startMessage.js",
    "start" : "npm-run-all --parallel open:src lint:watch sass:watch test:watch",
    "open:src": "babel-node tools/srcServer.js",
    "lint": "node_modules/.bin/esw webpack.config.* src tools",
    "lint:watch": "npm run lint -- --watch",
    "sass": "node-sass src/assets/**/*.scss src/assets/css",
    "sass:watch": "npm run sass -- --watch",
    "test:watch": "npm run test -- --watch",
    "test": "mocha --reporter progress tools/testSetup.js \"src/**/*.test.js\""
  },

now when I run npm run sass trough the terminal I get the following message:

[email protected] sass /Users/shooshte/PersonalProjects/introductionReact node-sass src/assets/**/*.scss src/assets/css

Rendering Complete, saving .css file... Error: EISDIR: illegal operation on a directory, open '/Users/shooshte/PersonalProjects/introductionReact/src/assets/css'

Both of the directories are created. What am I doing wrong?

If you need more info, just comment or you can also view the GitHub repo.

Thanks for the help.

like image 584
Miha Šušteršič Avatar asked Dec 19 '22 14:12

Miha Šušteršič


1 Answers

EISDIR means you are trying to run an operation on a file, but you gave a directory (folder).

"sass": "node-sass src/assets/**/*.scss src/assets/css/*.css"

update the code to target a .css file instead of a folder.

like image 100
Bamieh Avatar answered Jan 25 '23 22:01

Bamieh