首页 > 解决方案 > 我无法安装任何 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! ```

标签: npm

解决方案


似乎您错误地配置了您的代理信息,以下是如何从您的 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 

希望它可以帮助。


推荐阅读