在终端安装任何包,执行 npm i均报错
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
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 代理出错
可尝试依次执行:
npm config get proxy
npm config get https-proxy
两者均返回null,否则,执行set null的命令,再安装淘宝镜像
npm config set registry http://registry.cnpmjs.org/
npm install -g cnpm --registry=https://registry.npm.taobao.org
之后可以执行npm i
了解不多,原理方面不太清楚,欢迎多多指教