Miha Šušteršič
Miha Šušteršič

Reputation: 10042

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.

Upvotes: 5

Views: 2980

Answers (1)

Bamieh
Bamieh

Reputation: 10906

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.

Upvotes: 13

Related Questions