错误如下
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t https://github.com/nhn/raphael.git
npm ERR!
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 20.205.243.166]: errno=Unknown error
npm ERR!
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\2209150234\AppData\Roaming\npm-cache\_logs\2023-03-29T02_02_20_678Z-debug.log
解决方法
1.应该由于npm install的网络的问题造成,建议将npm的源设置为国内的镜像,这样就可以大幅提升依赖安装速度。但是我使用淘宝镜像为:
//npm config set registry https://registry.npm.taobao.org
后
npm install
// 如果此时无用,将阿里镜像换成
npm config set registry https://registry.npmmirror.com
临时使用
临时: npm --registry https://registry.npmmirror.com install express
持久使用: npm config set registry https://registry.npmmirror.com