Npm express模块​​没有安装

时间:2016-04-05 08:59:52

标签: node.js express

我正在尝试使用命令提示符安装Node JS的express模块​​,但每次都会收到错误。我曾在其他地方的类似帖子中尝试过以下解决方案,但没有任何帮助。 1.以管理员模式运行cmd。 2.检查互联网问题。 我正在使用的命令是

npm install -g express-generator

我也尝试过gd而不是g。 错误文件内容为

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   '-g',
1 verbose cli   'express-generator' ]
2 info using npm@3.6.0
3 info using node@v5.7.1
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData express-generator
8 silly fetchNamedPackageData express-generator
9 silly mapToRegistry name express-generator
10 silly mapToRegistry using default registry
11 silly mapToRegistry registry https://registry.npmjs.org/
12 silly mapToRegistry uri https://registry.npmjs.org/express-generator
13 verbose request uri https://registry.npmjs.org/express-generator
14 verbose request no auth needed
15 info attempt registry request try #1 at 2:21:17 PM
 16 verbose request id b26b9ae72d812cde
17 http request GET https://registry.npmjs.org/express-generator
18 info retry will retry, error on last attempt: Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443

19 info attempt registry request try #2 at 2:21:27 PM
20 http request GET https://registry.npmjs.org/express-generator
21 info retry will retry, error on last attempt: Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443

22 info attempt registry request try #3 at 2:22:27 PM
23 http request GET https://registry.npmjs.org/express-generator
24 silly fetchPackageMetaData Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443

24 silly fetchPackageMetaData     at Object.exports._errnoException (util.js:856:11)

24 silly fetchPackageMetaData     at errnoException (dns.js:31:15)
24 silly fetchPackageMetaData     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

24 silly fetchPackageMetaData  error for express-generator { [Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443]
24 silly fetchPackageMetaData   code: 'EAI_AGAIN',
24 silly fetchPackageMetaData   errno: 'EAI_AGAIN',
24 silly fetchPackageMetaData   syscall: 'getaddrinfo',
24 silly fetchPackageMetaData   hostname: 'registry.npmjs.org',
24 silly fetchPackageMetaData   host: 'registry.npmjs.org',
24 silly fetchPackageMetaData   port: 443 }
25 silly rollbackFailedOptional Starting
26 silly rollbackFailedOptional Finishing
27 silly runTopLevelLifecycles Starting
28 silly runTopLevelLifecycles Finishing
29 silly install printInstalled
30 verbose stack Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443
30 verbose stack     at Object.exports._errnoException (util.js:856:11)
30 verbose stack     at errnoException (dns.js:31:15)
30 verbose stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

31 verbose cwd C:\Users\rachit.gupta09\NodejsApp
32 error Windows_NT 6.3.9600
33 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "express-generator"

34 error node v5.7.1
35 error npm  v3.6.0
36 error code EAI_AGAIN
37 error errno EAI_AGAIN
38 error syscall getaddrinfo
39 error getaddrinfo EAI_AGAIN registry.npmjs.org:443
40 error If you need help, you may report this error at:
40 error     <https://github.com/npm/npm/issues>
41 verbose exit [ 1, true ]

我运行此命令的目录包含我的js文件。任何帮助表示赞赏。感谢

1 个答案:

答案 0 :(得分:1)

正如评论中所提到的,您使用代理连接到互联网 - 默认情况下,NPM对此一无所知,因此您需要更改其全局配置设置。

npm config set proxy http://[Host]:[Port]
npm config set https-proxy http://[Host]:[Port]