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
To check the version, run the command: sass –version. The latest version is 1.49.
Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.
Node-sass is a library that provides binding for Node. js to LibSass, the C version of the popular stylesheet preprocessor, Sass. It allows you to natively compile . scss files to css at incredible speed and automatically via a connect middleware.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With