我将npm升级到了最新版本,现在无法再次运行任何npm命令,我卸载了节点js并再次下载了它,
当我运行npm install -g ionic@latest
时,在命令提示符下出现此错误:
npm WARN deprecated ionic@5.4.16: The Ionic CLI now uses ✨ @ionic/cli ✨ for its package name! ? https://twitter.com/ionicframework/status/1223268498362851330
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/env-paths 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 ERR! A complete log of this run can be found in:
npm ERR! C:\Users\De Stone Of David\AppData\Roaming\npm-cache\_logs\2020-03-23T11_48_48_277Z-debug.log
我现在不知道该怎么办,我还在Powershell中以admin身份运行了npm cache clean --force
,并得到了相同的错误。
答案 0 :(得分:0)
在这种情况下,仔细阅读错误消息可能会有所帮助。关键是
npm ERR!对https://registry.npmjs.org/env-paths的网络请求失败,原因:getaddrinfo ENOTFOUND Registry.npmjs.org
ENOTFOUND是您的操作系统传递给npm的消息。这意味着npm尝试使用域名服务(DNS)查找该注册表计算机的主机名失败。
因此,您遇到了网络连接问题,或者不太可能是防火墙问题。在计算机上的命令行上尝试此操作。
curl https://registry.npmjs.org
如果它也不起作用,请尝试重新启动计算机。如果那不起作用,请向网络工程师寻求帮助,并提及curl命令作为问题的证据。
某些家庭ISP(我在看您,Comcast)有时会出现连接故障,并显示为DNS故障。重新启动电缆调制解调器和路由器。如果仍然不能解决问题,请致电技术支持,并要求他们远程重置调制解调器。
如果您正在使用VPN,请尝试断开与它的连接,然后再次尝试执行npm操作。如果在没有VPN的情况下也可以使用,请向维护VPN的人寻求帮助。
从我的位置获取该主机名没有问题。