1

I am doing a program, I meet some question when I use the npm script with Mac system;
I have already install the node-sass globally, the package.json file is as follows: package.json
it is not work when I run "npm run build:css",while the error the system tell me is as the follow picture: the err discription but I can run the commend node-sass ./src/scss/pages/index.scss ./static/css/index.css successfully in the terminal and if I add another line like "create":"touch sun.js" to package.json, it works well when I run npm run create;

I am confused, I will be grateful if someone can give some suggestion.

sunliying
  • 11
  • 1
  • 2

2 Answers2

1

It might be that the node-sass module that's installed locally in the working directory is missing dependencies, or is otherwise partially configured. Try running npm install to restore any missing dependencies.

The reason node-sass runs successfully in the terminal might be because it's running from a different (probably global) installation. Run which node-sass to find the location of the running executable..

  • I have installed node-sass locally and globally,and I didn't miss the dependencies, I have solved this problem by uninstalling node-sass locally , and it works well now; I think maybe the local node-sass misleading the `npm run` command ; so the global `node-sass` doesn't work. – sunliying May 02 '16 at 03:16
1

Why do you use node-sass? Here is my script, try this:

"scripts": {
    "sass": "sass --sourcemap=none --watch resources/assets/sass:public/assets/css"
  }

If you need the source map, just delete the --sourcemap=none part, and of course, change the source and destination path.

pkovzz
  • 353
  • 2
  • 5
  • 13
  • I didn't use sass because sass need the environment with ruby, not all my partners have installed it, so I choose node-sass – sunliying May 02 '16 at 03:08