我在安装了一个新的nodejs安装后,在我的Windows 10机器上安装任何模块时遇到了问题。
它是我的笔记本电脑,所以我有完全访问权等。
我浏览了很多论坛,似乎并不是这个问题的明确答案。
npm-debug返回以下内容:
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.10.10
3 info using node@v6.10.0
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 data Result {
12 silly mapToRegistry raw: 'express-generator',
12 silly mapToRegistry scope: null,
12 silly mapToRegistry escapedName: 'express-generator',
12 silly mapToRegistry name: 'express-generator',
12 silly mapToRegistry rawSpec: '',
12 silly mapToRegistry spec: 'latest',
12 silly mapToRegistry type: 'tag' }
13 silly mapToRegistry uri (link to express generator)
14 verbose request uri (link to express generator)
15 verbose request no auth needed
16 info attempt registry request try #1 at 9:25:54 PM
17 verbose request id 10ea30ec4da3c14a
18 http request GET (link to express generator)
19 info retry will retry, error on last attempt: Error: write EPROTO
101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20
19 info retry 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
20 info attempt registry request try #2 at 9:26:05 PM
21 http request GET https://registry.npmjs.org/express-generator
22 info retry will retry, error on last attempt: Error: write EPROTO 101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20
22 info retry 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
23 info attempt registry request try #3 at 9:27:05 PM
24 http request GET (link to express generator)
25 silly fetchPackageMetaData Error: write EPROTO 101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20
25 silly fetchPackageMetaData 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
25 silly fetchPackageMetaData
25 silly fetchPackageMetaData at exports._errnoException (util.js:1022:11)
25 silly fetchPackageMetaData at WriteWrap.afterWrite (net.js:801:14)
25 silly fetchPackageMetaData error for express-generator { Error: write EPROTO 101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20
25 silly fetchPackageMetaData 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
25 silly fetchPackageMetaData
25 silly fetchPackageMetaData at exports._errnoException (util.js:1022:11)
25 silly fetchPackageMetaData at WriteWrap.afterWrite (net.js:801:14) code: 'EPROTO', errno: 'EPROTO', syscall: 'write' }
26 silly rollbackFailedOptional Starting
27 silly rollbackFailedOptional Finishing
28 silly runTopLevelLifecycles Finishing
29 silly install printInstalled
30 verbose stack Error: write EPROTO 101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20
30 verbose stack 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
30 verbose stack
30 verbose stack at exports._errnoException (util.js:1022:11)
30 verbose stack at WriteWrap.afterWrite (net.js:801:14)
31 verbose cwd C:\Users\stu\Desktop\node
32 error Windows_NT 10.0.14393
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 v6.10.0
35 error npm v3.10.10
36 error code EPROTO
37 error errno EPROTO
38 error syscall write
39 error write EPROTO 101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20
39 error 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
40 error If you need help, you may report this error at:
40 error github issues link
41 verbose exit [ 1, true ]
任何帮助都会很棒。
答案 0 :(得分:2)
您使用的是旧版本的npm(3.10.10)。我建议更新到最新版本(截至此帖子 - 4.4.1稳定版):
> npm install -g npm
如果上述情况失败:
> npm update -g npm
如果您仍有问题,可以尝试:
> npm config set ca ""
或(我不鼓励,但至少应该确认问题):
> npm config set strict-ssl false
作为旁注,您发布的大部分信息都无关紧要。主要问题是在输出结束附近发现。您似乎遇到了SSL问题。
21 http request GET https://registry.npmjs.org/express-generator
22 info retry will retry, error on last attempt: Error: write EPROTO 101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20
22 info retry 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
请参阅:receiving error: 'Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN' while using npm