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

Mr.*_*r.D 0 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:
Run Code Online (Sandbox Code Playgroud)

有什么方法可以将下载地址重置为默认地址吗?

我正在使用 Windows 版本的 NodeJS

ale*_*mac 8

看起来您的registrynpm 配置选项指向错误的位置。它必须是https://registry.npmjs.org,使用以下命令检查它:

npm config get registry
Run Code Online (Sandbox Code Playgroud)

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

npm config set registry https://registry.npmjs.org/
Run Code Online (Sandbox Code Playgroud)