0
$ npm install -g bower
npm ERR! network getaddrinfo ENOTFOUND
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
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! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files (x86)\\nodejs\\node.exe" "c:\\Program Files
(x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "bower"
npm ERR! cwd d:\Cpy Work\Yohaat Work\YOHAAT
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! syscall getaddrinfo
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     d:\Cpy Work\Yohaat Work\YOHAAT\npm-debug.log
npm ERR! not ok code 0
4

1 回答 1

0

这里有两个问题。

首先,您可能在代理后面。这npm就是试图在错误消息中告诉您的内容。

This is most likely not a problem with npm itself npm ERR! network and is 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'

要查找您的代理设置,您可以使用此 powershell 命令:

Windows-R to open the "Run" window Type powershell and click OK Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyServer .... ProxyServer : host:port

您应该会看到下面显示的代理服务器。在您的npm配置中使用前导进行设置http://

npm config set http_proxy "http://host:port"

如果您有任何其他问题,请将您的 npm-debug.log 作为 gist http://gist.github.com上传?如果可能,使用至少一个-d标志运行 npm 以提高日志记录级别。

自 1.4.28 以来,npm 已经有了很多改进——尤其是在安装期间的冲突和竞争条件方面。您可以尝试更新您的 npm 安装吗?

要更新 npm,请运行npm -g install npm@latest

要在 Windows 上更新 npm,请按照此处的说明进行操作:https ://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

谢谢!

于 2015-01-16T13:08:37.087 回答