Electron 7 and above fails to install with Getaddrinfo ENOTFOUND github.com on launchpad / build.snapcraft.io

A similar issue has been reported before, but the workaround required now is a little different, so i just wanted to share my findings here to save others the headache. The error looks like this:

> electron@10.1.3 postinstall /build/ubports-installer/parts/ubports-installer/build/node_modules/electron
> node install.js

RequestError: getaddrinfo ENOTFOUND github.com github.com:443
    at ClientRequest.request.once.error (/build/ubports-installer/parts/ubports-installer/build/node_modules/@electron/get/node_modules/got/source/request-as-event-emitter.js:178:14)
    at Object.onceWrapper (events.js:286:20)
    at ClientRequest.emit (events.js:203:15)
    at ClientRequest.EventEmitter.emit (domain.js:448:20)
    at ClientRequest.origin.emit.args (/build/ubports-installer/parts/ubports-installer/build/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at TLSSocket.EventEmitter.emit (domain.js:448:20)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)

The postinstall script for Electron 7 and above (i ran into it with 10.1.3) currently has an issue with proxy resolution. The standard env vars are not passed on properly, causing an error with the @electron/get package. To work around this issue, run the following command instead of npm install:

npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=$https_proxy npm install

That should work.

take a look here:

(there is a launchpad bug about this too)

1 Like