If you get stuck during npm install and do not move, you can try the following methods.
- Set up the registration center and use the Taobao registration center.
- This mainly solves the download failure caused by network problems.
npm config set registry https://registry.npmmirror.com
After setting, younpm config get
can use it to view the setting results. According to the notification from the official website , the Taobao mirror has been replaced with a mirror.npmjs.org
- This mainly solves the download failure caused by network problems.
- Delete the node_modules folder and execute npm install
- We all know that the packages installed by npm install are all in node_modules. After deleting node_modules, it can prevent the secondary download failure caused by a package download failure.
- delete
package-lock.json
filepackage-lock.json
The file will lock the version, and sometimes the download fails because the local nodejs version does not match the version in the locked file, and the node_modules folder must also be deleted.
- node-sass version does not match local nodejs version
- Check
package.json
whether the version of node-sass matches the local version of nodejs. There is a dependency table on the official website of node-sass. If they do not match, consider using nvm to adjust the version of nodejs
- Check