Sass compilation error

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?

1 Like

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.

1 Like

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?

1 Like

My guess is it’s just the same command run twice. Just a guess though.

1 Like

Yes. Right, my bad. Thank you.

2 Likes

Thank for the help @lasjorg @Sky020
I successfully compile sass to css: I simply uninstalled the previous sass version and try compiling the code once again. Voila, It works!!! :slightly_smiling_face: