Adi*_*idi 7 node.js npm npm-install
在我将nodejs更新到最新版本后,我总是在尝试运行npm install安装包时遇到错误:
npm WARN registry Using stale data from http://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale package data from http://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/escope failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
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'
Run Code Online (Sandbox Code Playgroud)
我没有任何与我的互联网连接有任何问题,我禁用https:https://registry.npmjs.org的路线,并将其替换为http - 第一次安装工作,并在开始后不再工作.
节点版本 8.2.1
npm版本 5.3.0
谢谢你的帮助.
Adi*_*idi 15
如果它对任何人都有帮助:对我有用的唯一解决方案是ping注册表以找到IP.我拥有IP的事实意味着我没有被阻止
ping registry.npmjs.org
64 bytes from registry.npmjs.org (151.101.60.162): icmp_seq=1 ttl=52 time=87.3 ms
在我的hosts文件上设置IP到此主机(Im in centos/etc/hosts /):
151.101.60.162 registry.npmjs.org
我几乎肯定这是NPM的一些小故障
小智 13
您可能需要检查NPM代理设置并将其删除.
npm config get proxy
npm config rm proxy
npm config rm https-proxy
Run Code Online (Sandbox Code Playgroud)
有人可能期望全新安装的NodeJS + NPM不会配置代理.奇怪的是,我的确定了一个代理定义,指向IP和端口3128.删除代理就行了.