electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.67k stars 1.74k forks source link

how to specify dist url of electronjs header? #7221

Closed leftstick closed 1 year ago

leftstick commented 2 years ago

when i run below command:

electron-builder install-app-deps

I got following error:

 • electron-builder  version=23.6.0
  • loaded configuration  file=package.json ("build" field)
  • rebuilding native dependencies  dependencies=node-pty@0.10.1 platform=darwin arch=arm64
  • rebuilding native dependency  name=node-pty version=0.10.1
  ⨯ cannot execute  cause=exit status 1
yarn run v1.22.19
node scripts/install.js
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

                    errorOut=gyp http GET https://electronjs.org/headers/v21.2.0/node-v21.2.0-headers.tar.gz
    gyp WARN install got an error, rolling back install
    gyp ERR! configure error
    gyp ERR! stack FetchError: request to https://www.electronjs.org/headers/v21.2.0/node-v21.2.0-headers.tar.gz failed, reason: read ECONNRESET
    gyp ERR! stack     at ClientRequest.<anonymous> (/Users/superman/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
    gyp ERR! stack     at ClientRequest.emit (node:events:527:28)
    gyp ERR! stack     at TLSSocket.socketErrorListener (node:_http_client:454:9)
    gyp ERR! stack     at TLSSocket.emit (node:events:539:35)
    gyp ERR! stack     at emitErrorNT (node:internal/streams/destroy:157:8)
    gyp ERR! stack     at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
    gyp ERR! System Darwin 21.3.0
    gyp ERR! command "/Users/superman/.nvm/versions/node/v16.15.1/bin/node" "/Users/superman/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /Users/superman/codes/coding-cell/node_modules/node-pty
    gyp ERR! node -v v16.15.1
    gyp ERR! node-gyp -v v9.0.0
    gyp ERR! not ok
error Command failed with exit code 1.

                    command=/Users/superman/.nvm/versions/node/v16.15.1/bin/node /opt/homebrew/Cellar/yarn/1.22.19/libexec/bin/yarn.js run install
                    workingDir=/Users/superman/codes/coding-cell/node_modules/node-pty
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

The reason i think should be my laptop network, it is a company network behind a private proxy. And electron-builder seems not read the system proxy variable(HTTP_PROXY, HTTPS_PROXY), so the download failed

I can download the header file manually on my laptop, and launch a static server locally. So i am wondering if there is way to specify the download URL?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 5 days with no activity.

whw19950510 commented 1 year ago

I met with same issue... set npm_config_disturl doesn't help. This need to be resolved

Corvus278 commented 1 month ago

You can add npm_config_disturl env, but it will be override in packages/app-builder-lib/src/util/yarn.ts:getGypEnv : image

For solve this, I just add this code with patch-package in /node_modules/app-builder-lib/out/util/yarn.js:getGypEnv : image