Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the fix for Error: Node Sass version 8.0.0 is incompatible with ^4.0.0?

Tags:

node-sass

So, I had used sass before using npm install node-sass for my reactjs project. I'm now working on a new project and wanted to use sass again. With the same syntax npm install node-sass to get it installed, I continued to get

./src/components/Main.scss (./node_modules/css-loader??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/react-scripts/node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-3!./src/components/Main.scss)
Error: Node Sass version 8.0.0 is incompatible with ^4.0.0.

Or

to import sass files, you first need to install node-sass. run `npm install node-sass` or `yarn add node-sass` inside your workspace
...
...

I followed the instructions to have sass installed from the links npmjs sass-lang using these syntaxes

brew install sass/sass/sass
npm install -g sass

but I'm still encountering either errors I mentioned earlier.

I tried deleting the node-module folder, package-lock.json and reinstalled node-modules. That still did not fix the error. Also, I followed how others got around fixing Node Sass version 5.0.0||6.0.0|| 7.0.0 incompatibility issue but that did not fix mine.

I'm seeking help now.

like image 914
Jalamang Janka Avatar asked Sep 02 '25 05:09

Jalamang Janka


1 Answers

Don't use node-sass anymore

node-sass is now deprecated. You can easily fix it by the following.

npm uninstall node-sass
npm install sass

It works fully the same with better stability, You will not need to make any additional changes.

And all Works well !



But if you still prefer to use node-sass

You can use the following table to install the appropriate version node-sass for your installed Node.js version which you can check by the command node --version.

npm install node-sass@(your version)

enter image description here

like image 83
Abraham Avatar answered Sep 05 '25 00:09

Abraham