我已经将node.js (v0.12.8)和npm (v2.14.9)交叉编译到ARM compile A5。如果我成功运行node.js示例hello world work。
但是,当我尝试通过npm安装任何包时,结果都是:
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org
遵循完整的调试信息:
root@myboard:/# npm install -g forever -d
npm info it worked if it ends with ok
npm info using npm@2.14.9
npm info using node@v0.12.8
npm info attempt registry request try #1 at 19:05:56
npm http request GET http://registry.npmjs.org/forever
npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org
npm info attempt registry request try #2 at 19:06:06
npm http request GET http://registry.npmjs.org/forever
npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org
npm info attempt registry request try #3 at 19:07:06
npm http request GET http://registry.npmjs.org/forever
npm ERR! Linux 3.18.23
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "forever" "-d"
npm ERR! node v0.12.8
npm ERR! npm v2.14.9
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org
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 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! Please include the following file with any support request:
npm ERR! /npm-debug.log
root@myboard:/#
root@myboard:/# ping registry.npmjs.org
PING registry.npmjs.org (185.31.17.162): 56 data bytes
64 bytes from 185.31.17.162: seq=0 ttl=54 time=64.314 ms
64 bytes from 185.31.17.162: seq=1 ttl=54 time=64.403 ms
64 bytes from 185.31.17.162: seq=2 ttl=56 time=64.846 ms
^C
--- registry.npmjs.org ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 64.314/64.521/64.846 ms
root@myboard:/#在stackoverflow或google中,我找到了关于这个问题的信息,但都说是关于代理配置的,但我没有使用任何代理,因为myboard是通过电缆直接连接到路由器的,并且仍然连接到互联网。在示例中,我可以正确ping主机:registry.npmjs.org,但npm无法识别。
我还尝试了设置npm config,但没有成功:
npm config set strict-ssl false
npm config set registry http://registry.npmjs.org/
我希望对这个问题有任何解决办法。
发布于 2017-05-05 00:22:51
我也遇到了同样的问题,这是因为我的hosts文件中包含以下条目
185.31.17.162 registry.npmjs.org一旦我删除了它,一切都运行得很完美。这是我在2016年10月的DYN攻击中添加的一个变通方法。
https://stackoverflow.com/questions/34274886
复制相似问题