Windows の Node.js Bower などで SSLエラーが発生する

以下のようなSSLエラーが発生する。

Node.js

  1. PS C:\workspaces\vscode\reactlesson> npm install react-create-app
  2. npm ERR! Windows_NT 10.0.15063
  3. npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "reac
  4. t-create-app"
  5. npm ERR! node v6.10.2
  6. npm ERR! npm v3.10.10
  7. npm ERR! code EPROTO
  8. npm ERR! errno EPROTO
  9. npm ERR! syscall write
  10.  
  11. npm ERR! write EPROTO 101057795:error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SS
  12. L alert number 20
  13. npm ERR! 101057795:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:
  14. npm ERR!
  15. npm ERR!
  16. npm ERR! If you need help, you may report this error at:
  17. npm ERR!
  18. npm ERR! Please include the following file with any support request:
  19. npm ERR! C:\workspaces\vscode\reactlesson\npm-debug.log

SSLを使用しない用に、以下のファイルのregistry のプロトコルをhttps から http に編集する。

C:\Program Files\nodejs\node_modules\npm\lib\config\default.js

  1. registry: 'http://registry.npmjs.org/',

Bower

インストールしたbowerでも同様のエラーが発生する

  1. > bower search react
  2.  
  3.  
  4. bower EPROTO Request to https://bower.herokuapp.com/packages/search/react failed: write EPROTO 101057795:error:140943FC:SSL
  5. routines:ssl3_read_bytes:sslv3 alert bad record mac:openssl\ssl\s3_pkt.c:1493:SSL alert number 20 101057795:error:1409E0E5:SSL rout
  6. ines:ssl3_write_bytes:ssl handshake failure:openssl\ssl\s3_pkt.c:659:

Node.js と同様に、registry の プロトコルを https から http に変更する

\%USERPROFILE%\AppData\Roaming\npm\node_modules\bower\lib\node_modules\bower-config\lib\util\defaults.js

  1. var defaults = {
  2. 'directory': 'bower_components',
  3. 'registry': 'http://bower.herokuapp.com',
  4. 'shorthand-resolver': 'http://github.com/{{owner}}/{{package}}.git',
  5. 'tmp': paths.tmp,
  6. 'proxy': proxy,

Follow me!

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です