想尝试下electron开发桌面应用,于是按照官网的流程试了下,发现了个问题。
一、问题
在使用npm install 命令的时候,发现了个error,导致后面demo起不来,报错内容如下:
- PS D:\github\electron-quick-start> npm install
- > electron@2.0.0 postinstall D:\github\electron-quick-start\node_modules\electron
- > node install.js
- Downloading SHASUMS256.txt
- Error: socket hang up
- D:\github\electron-quick-start\node_modules\electron\install.js:47
- throw err
- ^
- Error: socket hang up
- at createHangUpError (_http_client.js:331:15)
- at TLSSocket.socketOnEnd (_http_client.js:423:23)
- at emitNone (events.js:111:20)
- at TLSSocket.emit (events.js:208:7)
- at endReadableNT (_stream_readable.js:1056:12)
- at _combinedTickCallback (internal/process/next_tick.js:138:11)
- at process._tickCallback (internal/process/next_tick.js:180:9)
- npm ERR! code ELIFECYCLE
- npm ERR! errno 1
- npm ERR! electron@2.0.0 postinstall: `node install.js`
- npm ERR! Exit status 1
- npm ERR!
- npm ERR! Failed at the electron@2.0.0 postinstall script.
- npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
- npm ERR! A complete log of this run can be found in:
- npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-07-21T08_04_44_902Z-debug.log
处理方法:
更换淘宝的镜像
- npm install cnpm -g --registry=http://registry.npm.taobao.org
使用cnpm install更新后没有问题。
不管为啥了,先记下,快去玩electron咯。