Miha Šušteršič Miha Šušteršič -4 years ago 276
Javascript Question

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:

Introduction@1.0.0 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

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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download