安装electron提示install.js error的问题

前端之家收集整理的这篇文章主要介绍了安装electron提示install.js error的问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

想尝试下electron开发桌面应用,于是按照官网的流程试了下,发现了个问题。

一、问题

在使用npm install 命令的时候,发现了个error,导致后面demo起不来,报错内容如下:

  1. PS D:\github\electron-quick-start> npm install
  2.  
  3. > electron@2.0.0 postinstall D:\github\electron-quick-start\node_modules\electron
  4. > node install.js
  5.  
  6. Downloading SHASUMS256.txt
  7. Error: socket hang up
  8. D:\github\electron-quick-start\node_modules\electron\install.js:47
  9.  throw err
  10.  ^
  11.  
  12. Error: socket hang up
  13.  at createHangUpError (_http_client.js:331:15)
  14.  at TLSSocket.socketOnEnd (_http_client.js:423:23)
  15.  at emitNone (events.js:111:20)
  16.  at TLSSocket.emit (events.js:208:7)
  17.  at endReadableNT (_stream_readable.js:1056:12)
  18.  at _combinedTickCallback (internal/process/next_tick.js:138:11)
  19.  at process._tickCallback (internal/process/next_tick.js:180:9)
  20. npm ERR! code ELIFECYCLE
  21. npm ERR! errno 1
  22. npm ERR! electron@2.0.0 postinstall: `node install.js`
  23. npm ERR! Exit status 1
  24. npm ERR!
  25. npm ERR! Failed at the electron@2.0.0 postinstall script.
  26. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  27.  
  28. npm ERR! A complete log of this run can be found in:
  29. npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-07-21T08_04_44_902Z-debug.log

处理方法

更换淘宝的镜像

  1. npm install cnpm ---registry=http://registry.npm.taobao.org

使用cnpm install更新后没有问题。

不管为啥了,先记下,快去玩electron咯。


猜你在找的Electron相关文章