在运行react项目,npm install 拉取依赖时报错
解决方案(详细方案):
出现这种问题多半是两个问题造成的:(1)、网络问题,(2)、react脚手架问题
1、更换npm镜像
// 更换为淘宝镜像
npm config set registry https://registry.npm.taobao.org
// 查看npm镜像是否更换
npm config get registry
2、重新全局下载REACT脚手架(保证网络良好)
npm install -g cnpm --registry=https://registry.npm.taobao.org
3、清空重新下载依赖
// 清空下载的依赖
npm cache clear --force
// 重新下载
npm i