错误信息:
connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Error while downloading https://github.com/npm/cli/archive
panic: runtime error: invalid memory address or nil pointer dereference
![](https://img-blog.csdnimg.cn/img_convert/b22585d5d6a3dfe256a75c96d731f8a7.png)
解决方法:
设置 nvm node 的镜像:
nvm node_mirror https://npm.taobao.org/mirrors/node/
![](https://img-blog.csdnimg.cn/img_convert/557e5e426b7e0c15d632eafaaa6816f4.png)
设置nvm npm 的镜像:
nvm npm_mirror https://npm.taobao.org/mirrors/npm/
![](https://img-blog.csdnimg.cn/img_convert/74d84c9e6a144ef3501d410a40fc72ab.png)
3.再次使用nvm下载所需版本(我这选择16.19.0)
![](https://img-blog.csdnimg.cn/img_convert/9b632d4896b1a27fe3f78842138b5e41.png)
安装成功
使用该版本:nvm use 16.19.0(输入你安装的版本号)
![](https://img-blog.csdnimg.cn/img_convert/da10961f6c7d3288493f4c627ad0e8a7.png)
并检查该版本下对应的node 和 npm 是否安装成功
检查node版本:node -v
检查npm版本:npm -v
![](https://img-blog.csdnimg.cn/img_convert/a31b2c7a86a33398dc6c93d91fb4fa6f.png)