Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env.ELECTRON_MIRROR is broken #299

Closed
fritx opened this issue Sep 10, 2024 · 1 comment
Closed

env.ELECTRON_MIRROR is broken #299

fritx opened this issue Sep 10, 2024 · 1 comment

Comments

@fritx
Copy link
Contributor

fritx commented Sep 10, 2024

Hi, my friends!
I've found env vars such as ELECTRON_MIRROR seems to be no longer recognized. They're still documented in README:
https://github.com/electron/get/blob/main/README.md?plain=1#L102-L108

Code search:
https://github.com/search?q=repo%3Aelectron%2Fget%20mirror&type=code

I can not specify the env.ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ (it is always npm.taobao.org), and keep getting such error when npm install electron:

 ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm i
 WARN  17 deprecated subdependencies found: @humanwhocodes/config-array@0.11.14, @humanwhocodes/object-schema@2.0.3, @npmcli/move-file@2.0.1, are-we-there-yet@3.0.1, asar@3.2.0, electron-packager@17.1.2, gar@1.0.4, gauge@4.0.4, glob@7.2.3, glob@8.1.0, inflight@1.0.6, npmlog@6.0.2, rimraf@2.6.3, rimraf@3.0.2, xterm-addon-fit@0.5.0, xterm-addon-search@0.8.2, xterm@4.19.0
Packages: +1223
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1223, reused 1223, downloaded 0, added 0, done
node_modules/.pnpm/electron@25.9.2/node_modules/electron: Running postinstall script, failed in 1.5s
.../node_modules/electron postinstall$ node install.js
│ RequestError: Hostname/IP does not match certificate's altnames: Host: npm.taobao.org. is not…
│     at ClientRequest.<anonymous> (/Users/fritx/we-gui/electron_tray_app/node_modules/.pnpm/go…
│     at Object.onceWrapper (node:events:633:26)
│     at ClientRequest.emit (node:events:530:35)
│     at origin.emit (/Users/fritx/we-gui/electron_tray_app/node_modules/.pnpm/@szmarczak+http-…
│     at TLSSocket.socketErrorListener (node:_http_client:500:9)
│     at TLSSocket.emit (node:events:518:28)
│     at emitErrorNT (node:internal/streams/destroy:169:8)
│     at emitErrorCloseNT (node:internal/streams/destroy:128:3)

May be related to: electron/electron#32076, electron/electron#41089, cnpm/cnpmjs.org#1052

@BlackHole1
Copy link
Member

When dealing with MIRROR, there are many priorities involved, see:

return (
// .npmrc
process.env[`npm_config_electron_${name.toLowerCase()}`] ||
process.env[`NPM_CONFIG_ELECTRON_${snakeName.toUpperCase()}`] ||
process.env[`npm_config_electron_${snakeName}`] ||
// package.json
process.env[`npm_package_config_electron_${name}`] ||
process.env[`npm_package_config_electron_${snakeName.toLowerCase()}`] ||
// env
process.env[`ELECTRON_${snakeName.toUpperCase()}`] ||
options[name] ||
defaultValue
);
}

Therefore, in your case, it may be because the mirror was configured as npm.taobao.org elsewhere.

I will close this issue first. If you still have problems after checking, I will reopen this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants