相关文章推荐
正直的豆芽  ·  [MY-010273] [Server] ...·  4 月前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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 '/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.

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.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.