Cannot Find Module ‘sass’

In this tutorial we are going to talk about the solution to an irritating error called “cannot find module ‘sass’” but first of all let’s see a quick introduction to the term sass.

What is Sass?

Sass is a module in reactjs it’s like an advanced or updated version of CSS. Sass has the ability to perform some functions it can have variables, properties, and many more operations we can apply for designing purposes using the SASS module. It will enhance the look and performance of your reactjs application.

Now let’s first discuss the reason behind the occurrence of the “cannot find module ‘sass’” error.

This error occurs when it could not find the sass module in the system means before running a react js program make sure to install the sass module first otherwise you will get the “cannot find module ‘sass’” error, Let’s move forward to the solution.

How To Solve Cannot Find Module ‘sass’

We have three possible solutions to fix this error the first one is defined below.

Solution 1

To solve the “cannot find module ‘sass’” error all you have to do is just install the sass module but first remove the cache by running the following command.

npm cache clear –force

After clearing the cache install the sass module using the following command.

npm install sass

Solution 2

The second way to fix this error you can check the dev dependencies and run the following command in the command prompt.

npm install --save-dev node-sass 

After executing the above command open the command prompt again and run the “npm start” command and then go to the package.json file and search for the dev dependencies where you can find the sass module if is it installed. The “devDependencies”: { “node-sass”: “^yourversion” } will help you out.

Solution 3

The third way is to uninstall the node-sass and install the dev sass check out the command below.

npm uninstall node-sass

After executing the above command run the following command to install the dev sass.

npm install --save-dev sass

And then you will not receive this error.

Conclusion

In this tutorial, we discussed the solutions for the “cannot find module ‘sass’” error we saw the three methods to get rid of this error.

I hope the above commands will help you to fix the error and that you like the tutorial.

If you have any queries regarding this tutorial so feel free to contact us below. Thanks for reading.

Leave a Comment