electron: Installation electron failed

Issue Details

There was an error when I executed the command npm i -D electron@latest.

(node:29679) UnhandledPromiseRejectionWarning: RequestError: connect ECONNREFUSED 0.0.0.0:443 at ClientRequest.<anonymous> (/node_modules/@electron/get/node_modules/got/source/request-as-event-emitter.js:178:14) at Object.onceWrapper (events.js:291:20) at ClientRequest.emit (events.js:208:15) at ClientRequest.origin.emit (/node_modules/@szmarczak/http-timer/source/index.js:37:11) at TLSSocket.socketErrorListener (_http_client.js:399:9) at TLSSocket.emit (events.js:203:13) at emitErrorNT (internal/streams/destroy.js:91:8) at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) at processTicksAndRejections (internal/process/task_queues.js:77:11) (node:29679) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:29679) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The node version:v12.8.1 The operating system:Mac osx10.15

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

@HeiShanLaoYao889

Try

npm config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/

@amorist cdn.npm.taobao.org is not in use now.

I write a package (electron-version-manager) to download electron binary file instead of electron npm package. The package supports mirror options as same as electron-builder. It works fine for me.

试了很多办法,都不行,官方也没人出来说,这个好坑

add a path.txt in node_modules/electron folder, and put electron or electron.exe into the path.txt, and download version you want unzip into node_modules/electron/dist it work.

在node_modules/electron文件夹下建个path.txt, 写进electron或是electron.exe(windows),去淘宝镜像上下载个对应版本的electron,解压到node_modules/electron/dist(没有就新建一个)文件夹下。

npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://140.82.113.3:443 yarn works for me. 140.82.113.3 is github.com IP.

use https://ping.chinaz.com/github.com to get github.com`s IP

I see your id is Hei Shan Lao Yao. I think GFW caused your problem. Try add an environment variable to your system.

key: ELECTRON_MIRROR value: https://npm.taobao.org/mirrors/electron/