一、
从svn拉取下项目后,依赖包一直安装失败,报错如下

尝试的解决办法:
1 去C:\user 删除 .npmrc文件
2 删除项目文件夹里的node_module
3 清除一下npm的缓存,再重新安装依赖
npm cache clean --force
npm install
还是没成功 注:有的博主成功不报错
我又尝试着降低了下node版本 ,从node16 降到 14.17.6
成功了,执行npm install即可
二、node-sass安装失败

原因:node和node-sass8.0.0版本不匹配,降低node版本到 14.18
重新安装 node-sass仍然报错,切换到淘宝源,成功
三、报错:Failed at the cwebp-bin@6.1.2 postinstall script

解决方式:
npm i --registry https://registry.npm.taobao.org --ignore-scripts
–registry https://registry.npm.taobao.org 修改npm的registry为淘宝镜像
–ignore-scripts 表示npm将不会运行在package.json中指定的scripts脚本。
本文介绍了在遇到npm安装依赖包失败时的常见解决方法,包括删除.npmrc文件、清理npm缓存、降低node版本。特别地,通过将node版本从16降低到14.17.6解决了某些包的安装问题。此外,对于node-sass安装失败,发现是版本不匹配,降级到14.18后,切换到淘宝源才成功安装。对于cwebp-bin的安装报错,使用淘宝源并忽略scripts脚本得以解决。
801

被折叠的 条评论
为什么被折叠?



