NPM,从错误的URL地址下载依赖项

时间:2018-12-07 05:59:48

标签: node.js npm

在处理了一些项目之后,我的npm开始从错误的地址全局下载依赖项:

npm install -g bower

npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://172.168.1.1/bower failed, reason: 
    connect ETIMEDOUT 172.168.1.1
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:

是否有一些方法可以将下载地址重置为默认地址?

我正在使用Windows版本的NodeJS

1 个答案:

答案 0 :(得分:1)

好像您的registry npm config选项指向错误的位置。它必须为https://registry.npmjs.org,并使用以下命令进行检查:

npm config get registry

如果您的注册表不同,请使用此命令正确设置它:

npm config set registry https://registry.npmjs.org/