我无法安装任何npm软件包

时间:2019-04-04 10:05:16

标签: npm

每次尝试安装npm软件包时,我都会不断收到此错误:

npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/json-server failed, reason: getaddrinfo ENOTFOUND proxy.company.com proxy.company.com:8181
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! ```

1 个答案:

答案 0 :(得分:2)

似乎您配置了代理信息,这是从cli中为npm配置它的方法:

npm config set proxy http://{user}:{password}@{proxy-url}:{proxy-port}
npm config set https-proxy http://{user}:{password}@{proxy-url}:{proxy-port}

,如果您不使用代理服务器:

npm config delete proxy
npm config delete https-proxy 

希望它可以提供帮助。