I try to compile my sass code to css using the command:
“npm run compile_sass” but keeps getting this error message below:
Did you npm install node-sass in the folder you are running the npm script from?
Thanks for reply.
Yes, I do and I have .scss as the file extension as well.
Not sure what is going on. Can you post the content of your package.json
?
I assume it is for a project and you need it to work with npm scripts. Can you try the live sass compiler extension for VS Code just to test?
Here is the package.json content
{
"name": "sass",
"version": "1.0.0",
"description": "sass",
"main": "index.js",
"scripts": {
"compile_sass": "node-sass sass/style.scss css/style.css -w"
},
"author": "",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.12.0"
}
}
I will consider using the live sass compiler as suggested.
Don’t see why it should be failing.
Try deleting the node_modules folder and remove node-sass from package.json. Then install it again (you don’t seem to have the latest version either).
If that doesn’t work, you can try installing it globally (-g
) even though that shouldn’t be necessary and it’s really not an optimal solution.
The error you have taken a screen shot of does not seem like the beginning of the error. Is there any more to it at the beginning?
My guess is it’s just the same command run twice. Just a guess though.
Yes. Right, my bad. Thank you.