Cannot find module ‘sass’

To note! node-sass is deprecated as by now!

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.

enter image description here

Instead you can see that Sass is followed on the Dart sass project!

react-scripts already moved that direction!

enter image description here

The used package now is sass! npm i -g sass or npm i sass --save-dev

If you go to npm sass page

enter image description here

This package is a distribution of Dart Sass, compiled to pure JavaScript with no native code or external dependencies. It provides a command-line sass executable and a Node.js API.

You can install Sass globally using npm install -g sass which will provide access to the sass executable. You can also add it to your project using npm install --save-dev sass. This provides the executable as well as a library.

What should be done

Install sass

Globally

npm i -g sass

or

Locally

npm i sass --save-dev

I personally prefer to always go with local installs! So that npm install will add it automatically! Sometimes too to maintain the versions per project!

And

enter image description here

enter image description here

App compilling and running after install!

old version of react scripts

If you are running on an old version that require node-sass!

Then you can Update to the latest version! And before that! You may like to remove node_modules and package-lock.json.

npm i react-scripts --save

After that npm install to install again the project dependencies

And you can go for installing sass step

Leave a Comment