I'm using Node.js 16.13.1 and created a React application and try used Sass, but when I try to run it, I get this error:
Node Sass version 7.0.0 is incompatible with ^4.0.0 || ^5.0.0 || ^6.0.0
If you want to use SCSS and Sass in your React app, try to do this:
First remove node-sass:
yarn remove node-sass
If you use npm:
npm uninstall node-sass
Then install sass instead of node-sass:
yarn add -D sass
or
npm i -D sass
Finally your SCSS and Sass files will be correctly compiled!
node-sass is deprecated. Instead use sass.
You can uninstall the old and install the new one
npm uninstall node-sass
npm install sass
But if you prefer to use node-sass
You can use the following table to install the appropriate version node-sass for your installed node version which you can check by the command node --version
npm install node-sass@(your version)
I figured out this issue using node-sass version 4.14.1 with the following commands.
With npm
npm uninstall node-sass
npm install node-sass@4.14.1
With yarn
yarn remove node-sass
yarn add node-sass@4.14.1