npm install 常见问题及解决方案

1. npm install 时出现 -4048的错误

解决方案:

清除缓存,命令如下:

npm cache clean -f

2. npm install 时出现 Cannot read property ‘match’ of undefined

解决方案:

方法1:
删除文件夹下的package-lock.json文件,重新执行
方法2:

rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install

以上命令逐条执行

3. npm install 时下载某些包失败

解决方案:

使用cnpm的方式下载
cnpm安装方法:执行命令

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

安装后使用cnpm install

猜你喜欢

转载自blog.csdn.net/qq_41494464/article/details/84980072