npm安装报错解决方案

1.设置镜像代理为

http://registry.cnpmjs.orgnode

原来我用的淘宝镜像(https://registry.npm.taobao.org)总是报错npm


2.清空npm缓存

npm cache clean --force缓存

3.将项目下的node_modules删除


4.从新install

npm i代理