在IDEA中安装vue-router(Vue.js官方的路由插件),报错npm ERR! errno ETIMEDOUT

416 阅读1分钟

我们只需要在IDEA的Terminal中输入一个命令即可

npm install vue-router --save

但是会给我报错

npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/vue-router failed, reason: connect ETIMEDOUT 104.16.20.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'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\fengbujue\AppData\Roaming\npm-cache\_logs\2022-05-26T06_28_01_066Z-debug.log

找了很多办法都没有办法安装好 最后参考了这篇文章才得以解决

npm install报错ERR! code ETIMEDOUT的解决办法 - 简书 (jianshu.com)

解决方案:

1.查看npm镜像设置
npm config get registry
2.将npm设置为淘宝镜像
npm config set registry https://registry.npm.taobao.org
3.再次查看npm镜像设置
npm config get registry