今天在项目中用npm install安装依赖时,遇到了一个这样的问题
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.cnpmjs.org/axios failed, reason: getaddrinfo ENOTFOUND registry.cnpmjs.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 config set proxy null // proxy:外部请求的代理
npm config set https-proxy null // https-proxy:用于代理https请求的
npm config的更多学习资料见 大佬的文章npm-config