今天运行npm install,一开始报错是:
这是由于npm不再支持自签名证书。因为npm install走的是https协议,需要通过数字证书来保证。
解决方法: 取消ssl验证
npm cache clean --force
或
打开C:/User/用户 删除.npmrc(这是个隐藏文件)
npm config set strict-ssl false
到这里还是不够的,直接npm install会卡住,然后报错:
此时更换一下镜像即可:
查看当前镜像:
npm config get registry
更换为淘宝镜像:
npm config set registry https://registry.npm.taobao.org
再次查看镜像:
npm config get registry
切换成功后再执行npm install就OK啦!