sunliying
sunliying

Reputation: 11

"npm run build:css " can not work, while it is ok when I run the script self

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.

Upvotes: 1

Views: 10805

Answers (2)

pkovzz
pkovzz

Reputation: 364

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.

Upvotes: 1

user458541
user458541

Reputation:

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

Upvotes: 1

Related Questions