Node.js安装socket.io错误

时间:2016-02-05 09:07:04

标签: node.js socket.io

=============================================== ======================= 当我尝试安装install socket.io时,遇到错误。请参阅cmd图像和日志文件。

enter image description here

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'socket.io' ]
2 info using npm@2.14.12
3 info using node@v4.2.6
4 verbose install initial load of C:\inetpub\wwwroot\Test_NodeJSSocketIO\package.json
5 verbose readDependencies loading dependencies from C:\inetpub\wwwroot\Test_NodeJSSocketIO\package.json
6 silly cache add args [ 'socket.io', null ]
7 verbose cache add spec socket.io
8 silly cache add parsed spec Result {
8 silly cache add   raw: 'socket.io',
8 silly cache add   scope: null,
8 silly cache add   name: 'socket.io',
8 silly cache add   rawSpec: '',
8 silly cache add   spec: 'latest',
8 silly cache add   type: 'tag' }
9 silly addNamed socket.io@latest
10 verbose addNamed "latest" is being treated as a dist-tag for socket.io
11 info addNameTag [ 'socket.io', 'latest' ]
12 silly mapToRegistry name socket.io
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/socket.io
16 verbose addNameTag registry:https://registry.npmjs.org/socket.io not in flight; fetching
17 verbose request uri https://registry.npmjs.org/socket.io
18 verbose request no auth needed
19 info attempt registry request try #1 at 16:55:55
20 verbose request id 4772f4039b89ce43
21 http request GET https://registry.npmjs.org/socket.io
22 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
23 info attempt registry request try #2 at 16:56:05
24 http request GET https://registry.npmjs.org/socket.io
25 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
26 info attempt registry request try #3 at 16:57:05
27 http request GET https://registry.npmjs.org/socket.io
28 verbose stack Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
28 verbose stack     at errnoException (dns.js:26:10)
28 verbose stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
29 verbose cwd C:\inetpub\wwwroot\Test_NodeJSSocketIO
30 error Windows_NT 6.1.7601
31 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io"
32 error node v4.2.6
33 error npm  v2.14.12
34 error code ENOTFOUND
35 error errno ENOTFOUND
36 error syscall getaddrinfo
37 error network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
37 error network This is most likely not a problem with npm itself
37 error network and is related to network connectivity.
37 error network In most cases you are behind a proxy or have bad network settings.
37 error network
37 error network If you are behind a proxy, please make sure that the
37 error network 'proxy' config is set properly.  See: 'npm help config'
38 verbose exit [ 1, true ]

我已经厌倦了以下方式,但没有运气。

 1. Run as administrator
 2. npm config set registry http://registry.npmjs.org/
 3. npm config set http_proxy=http://address:8080
 4. npm config get proxy -> null
 5. computer restarted.

非常感谢您的帮助!

2 个答案:

答案 0 :(得分:0)

这是一个标准的DNS错误。如果ping registry.npmjs.org不起作用,则无需工作,包括npm。

检查您的DNS设置。

答案 1 :(得分:0)

DNS无法解析,请尝试指向某些公共DNS,例如Google 8.8.8.8。如果您使用的是Linux,请将其添加到/etc/resolv.conf

  

nameserver 8.8.8.8

如果您使用的是Mac OS X,请转到System Preferences -> Network -> Choose your connection -> Advanced -> DNS添加8.8.8.8到该集合。

以下是Windowshttp://www.doxer.org/resolved-resolv-conf-windows-equivalent/

的执行方式

P.S好吧,你正在使用Windows,只是检查了你的图像;)