解决 ERR! errno ETIMEDOUT

时间:2025-04-27 11:59:41
C:\Users\fengxun>npm install cnpm -g
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/cnpm failed, reason: connect ETIMEDOUT 104.16.26.35:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config

解决方案:
采用cnpm镜像就可以解决了。

输入下面这个命令,安装完成之后,再接着安装就好了

npm install -g cnpm --registry=https://registry.npm.taobao.org

成功解决:

C:\Users\fengxun>npm install -g cnpm --registry=https://registry.npm.taobao.org
npm WARN deprecated har-validator@5.1.5: this
C:\Users\fengxun\AppData\Roaming\npm\cnpm -> C:\Users\fengxun\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm
+ cnpm@6.1.1
added 684 packages from 964 contributors in 20.322s