在 Windows 10 台机器上安装节点模块时出现问题

Issues installing node modules on Windows 10 machine

我在安装任何模块到我的 windows 10 机器上时遇到问题,这是在全新安装 nodejs 之后。

这是我的笔记本电脑,所以我有完全访问权限等等

我看了很多论坛,这个问题似乎没有一个明确的答案。

npm-debug returns 如下:

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 ]

任何帮助都会很棒。

您使用的是旧版本的 npm (3.10.10)。我建议更新到最新版本(从 post - 4.4.1 稳定版开始):

> npm install -g npm

或者如果上述方法失败:

> npm update -g npm

如果还有问题,可以尝试:

> npm config set ca ""

或者(我不鼓励,但至少应该确认问题):

> npm config set strict-ssl false

附带说明一下,您 post 阅读的大部分信息都是无关紧要的。主要问题出现在输出的末尾附近。您似乎遇到了 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