'Running npm run compile:sass returns error: npm ERR! missing script: compile:sass
The sass folders and files are in the correct place. What is wrong?
I have the package.json which I created, with this code in there.
{
"name": "starter",
"version": "1.0.0",
"description": "starter file",
"main": "index.js",
"scripts": {
"compile:sass": "node-sass sass/main.scss css/style.css -w"
},
"author": "Nez",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.12.0"
}
}
As you can see the script is called compile sass when I try to run it it keeps giving the error npm ERR! missing script: compile:sass
I have the sass compiler installed already as a dev dependency
Solution 1:[1]
I had this happen as well. The only way I could fix it was to move my files out of my dropbox folder on an external hard drive and move them to my main computers' hard drive. I think it has something to do with Dropbox, but I'm not sure.
Solution 2:[2]
One of your sass files has a syntax error
eg. file 1 has
- background: %pink
the %pink value is undefined you should check your files if %pink* is implemented
Solution 3:[3]
I had the same issue and tried everything until I simply saved the project files within my code editor and then all of a sudden it worked.
Solution 4:[4]
Add this to your code all you need to do is add npx before your node
I.e. npx node...
Then go to your terminal to that directory and run this command npm run compile:sass
Hope this works...because it worked for me will work for you too
Solution 5:[5]
I think you should check your file path
Solution 6:[6]
After 3 years! for me it's solved by rewriting the package.json "scripts" line :
"compile:sass": "node-sass sass/main.scss css/style.css -w"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | iidave |
| Solution 2 | Vince |
| Solution 3 | Bubbyseal |
| Solution 4 | Dean Whitehouse |
| Solution 5 | Junaid Qureshi |
| Solution 6 | Tsvetan Ganev |
