Hello Guys How are you all ? hope you all are fine. Recently I’ve created a blank React project, using the command: npx create-react-app
on npm v7.0.7 and Node v15.0.1. and then I tried to import blank .scss file to App component: But I am Facing This Below Error.
Error Stack :
Failed to compile.
./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-6-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-6-3!./node_modules/s
ass-loader/dist/cjs.js??ref--5-oneOf-6-4!./src/App.scss)
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
Cause Of Error ?
I’ve created a blank React project, using the command: npx create-react-app
on npm v7.0.7 and Node v15.0.1
Installed:
- React v17.0.1,
- node-sass v5.0.0,
Then I tried to import blank .scss file to App component: How to solve this error ?
The only reason why you get some error like that, it’s because your node version is not compatible with your node-sass version.
Solutions For This Error.
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
Question : How to solve Error: Node sass version 5.0.0 incompatible with ^4.0.0 ?
Answer : This Error Occurs Cause of version incompatible with sass version. Just uninstall node-sass and reinstall with below command line. that will solve your error.
Solution 1 : Uninstall node-sass
npm uninstall node-sass
npm install node-sass@4.14.1
Or, if using yarn (default in newer CRA versions)
yarn remove node-sass
yarn add node-sass@4.14.1
Solution 2 : Downgrade node-sass
- don’t install node-sass 5.0.0 yet (major version was just bumped).
- Uninstall node-sass
npm uninstall node-sass
- Then install the latest version (before 5.0)
npm install node-sass@4.14.1
Solution 3 : Use sass By
- Uninstall node-sass
npm uninstall node-sass
2. use sass by:
npm install -g sass
npm install --save-dev sass
Solution 4 : yarn remove node-sass
- If you happen to use CRA with default
yarn
package manager use the following. Worked for me.
yarn remove node-sass
yarn add node-sass@4.14.1
Solution 5 : This is version problem
This is version problem, install the right dependant version.
npm uninstall node-sass
npm install node-sass@4.14.1
Solution 6 : Follow Below Steps
- stop the server
- run commands are
npm uninstall node-sass
- check node-sass in
package.json
if node-sass is available in the file then again run Step2. npm install node-sass@4.14.1
<=== run command- wait until the command successfully runs.
- start-server using
npm start
Summery
So it’s all About All possible solutions. Hope this above all solution helped you a lot. Comment below Your thoughts and your queries. Comment Below on your suggestion.
Thank you so much sir! Its working for me
Welcome Marceline. And Thank You For Your Response.