NPM run dev Error Module build failed: Error: Cannot find module ‘node-sass’

For a project, you may pull it from another library, change a computer, or for other reasons, you need to re install the dependency environment,

Sometimes the node sass installation fails. This phenomenon is too normal, for example:

Don’t panic when you report an error. You can usually find the answer by reading the beginning of the error report. He said that he didn’t find the module node sass

In this case, you can go to the project dependency node_ Look inside the module and find that there is no such bag. Please reload it

npm install node-sass –save

This kind of error report is coming. This node sass package should be on a foreign site. It is very easy to fail in the process of pulling. If it is broken in the middle, it will be over. So the Taobao team made an image of NPM, called cnpm. They will mirror the packages on NPM to their own site. It is relatively smooth for the domestic ones to pull the domestic ones, so you need to have the function of cnpm first, and then use cnpm to install

1.npm install -g cnpm –registry= https://registry.npm.taobao.org

2.cnpm install node-sass –save

Check the node after loading_ Modules found that the installation was successful

Run NPM run dev

Read More: