Electron 初始化

mkdir my-electron-app && cd my-electron-app
npm init -y
npm i --save-dev electron

npm install.js 报错

> electron@12.0.7 postinstall D:\javascript\playbill\node_modules\electron
> node install.js

RequestError: read ECONNRESET
    at ClientRequest.<anonymous> (D:\javascript\playbill\node_modules\got\source\request-as-event-emitter.js:178:14)
    at Object.onceWrapper (events.js:421:26)
    at ClientRequest.emit (events.js:326:22)
    at ClientRequest.origin.emit (D:\javascript\playbill\node_modules\@szmarczak\http-timer\source\index.js:37:11)
    at TLSSocket.socketErrorListener (_http_client.js:469:9)
    at TLSSocket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:100:8)
    at emitErrorCloseNT (internal/streams/destroy.js:68:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
npm WARN playbill@1.0.0 No description

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@12.0.7 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@12.0.7 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\2021-05-09T12_40_24_916Z-debug.log

解决方案:

npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

DEMO

https://github.com/electron/electron/tree/v12.0.6/docs/fiddles/quick-start

 

posted @ 2021-05-09 21:19  rubekid  阅读(544)  评论(0编辑  收藏  举报