feat: add ELECTRON_INSTALL_ env vars#49981
Merged
Merged
Conversation
VerteDinde
approved these changes
Mar 2, 2026
VerteDinde
left a comment
Member
There was a problem hiding this comment.
Code looks good to me, pending API approval 👍
jkleinsc
requested changes
Mar 2, 2026
jkleinsc
left a comment
Member
There was a problem hiding this comment.
Overall LGTM, but I think it would be helpful to list the arch and platforms we support.
Comment on lines
+54
to
+66
| `arm64` machine), you can set the `ELECTRON_INSTALL_ARCH` environment variable: | ||
|
|
||
| ```shell | ||
| npm install --arch=x64 electron | ||
| ```sh | ||
| # Inside an npm script or with npx | ||
| ELECTRON_INSTALL_ARCH=x64 electron . | ||
| ``` | ||
|
|
||
| In addition to changing the architecture, you can also specify the platform | ||
| (e.g., `win32`, `linux`, etc.) using the `--platform` flag: | ||
|
|
||
| ```shell | ||
| npm install --platform=win32 electron | ||
| ```sh | ||
| # Inside an npm script or with npx | ||
| ELECTRON_INSTALL_PLATFORM=mas electron . |
Member
There was a problem hiding this comment.
Can we explicitly list what arches and platforms we support?
Member
Author
There was a problem hiding this comment.
Depends from version to version, but I added a little hint here: 1d3a211
Under the hood, @electron/get doesn't even define valid arch/platform combos in its types.
jkleinsc
reviewed
Mar 9, 2026
|
Release Notes Persisted
|
officialasishkumar
added a commit
to officialasishkumar/electron
that referenced
this pull request
Apr 13, 2026
The postinstall script resolves two things from the target platform:
1. Which artifact to download, via `downloadArtifact({ platform, ... })`.
Since electron#49981, `platform` is derived from
`ELECTRON_INSTALL_PLATFORM || npm_config_platform || process.platform`.
2. Which executable path to use for the `isInstalled()` cache check and
for the `path.txt` marker written after extraction, via
`getPlatformPath()`.
`getPlatformPath()` was not updated with the rest of that change and
still falls back to `npm_config_platform || os.platform()` only.
As a result, passing `ELECTRON_INSTALL_PLATFORM` (as documented in
`docs/tutorial/installation.md`) causes the two to disagree: the
download fetches the requested platform's zip, but `path.txt` and the
path sanity check are written against the host platform's executable
name. That in turn makes `isInstalled()` always return `false` on
subsequent runs (forcing redundant re-downloads) and makes the
executable path recorded in `path.txt` wrong for the artifact that
was actually extracted (e.g. `electron` written alongside a
`darwin`/`win32` build).
Check `ELECTRON_INSTALL_PLATFORM` first, matching the resolution used
for `downloadArtifact`.
Assisted-By: Claude Opus 4.6
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
This was referenced Apr 13, 2026
officialasishkumar
added a commit
to officialasishkumar/electron
that referenced
this pull request
Apr 16, 2026
The postinstall script resolves two things from the target platform:
1. Which artifact to download, via `downloadArtifact({ platform, ... })`.
Since electron#49981, `platform` is derived from
`ELECTRON_INSTALL_PLATFORM || npm_config_platform || process.platform`.
2. Which executable path to use for the `isInstalled()` cache check and
for the `path.txt` marker written after extraction, via
`getPlatformPath()`.
`getPlatformPath()` was not updated with the rest of that change and
still falls back to `npm_config_platform || os.platform()` only.
As a result, passing `ELECTRON_INSTALL_PLATFORM` (as documented in
`docs/tutorial/installation.md`) causes the two to disagree: the
download fetches the requested platform's zip, but `path.txt` and the
path sanity check are written against the host platform's executable
name. That in turn makes `isInstalled()` always return `false` on
subsequent runs (forcing redundant re-downloads) and makes the
executable path recorded in `path.txt` wrong for the artifact that
was actually extracted (e.g. `electron` written alongside a
`darwin`/`win32` build).
Check `ELECTRON_INSTALL_PLATFORM` first, matching the resolution used
for `downloadArtifact`.
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
officialasishkumar
added a commit
to officialasishkumar/electron
that referenced
this pull request
Apr 22, 2026
The postinstall script resolves two things from the target platform:
1. Which artifact to download, via `downloadArtifact({ platform, ... })`.
Since electron#49981, `platform` is derived from
`ELECTRON_INSTALL_PLATFORM || npm_config_platform || process.platform`.
2. Which executable path to use for the `isInstalled()` cache check and
for the `path.txt` marker written after extraction, via
`getPlatformPath()`.
`getPlatformPath()` was not updated with the rest of that change and
still falls back to `npm_config_platform || os.platform()` only.
As a result, passing `ELECTRON_INSTALL_PLATFORM` (as documented in
`docs/tutorial/installation.md`) causes the two to disagree: the
download fetches the requested platform's zip, but `path.txt` and the
path sanity check are written against the host platform's executable
name. That in turn makes `isInstalled()` always return `false` on
subsequent runs (forcing redundant re-downloads) and makes the
executable path recorded in `path.txt` wrong for the artifact that
was actually extracted (e.g. `electron` written alongside a
`darwin`/`win32` build).
Check `ELECTRON_INSTALL_PLATFORM` first, matching the resolution used
for `downloadArtifact`.
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
jkleinsc
pushed a commit
that referenced
this pull request
Apr 28, 2026
The postinstall script resolves two things from the target platform:
1. Which artifact to download, via `downloadArtifact({ platform, ... })`.
Since #49981, `platform` is derived from
`ELECTRON_INSTALL_PLATFORM || npm_config_platform || process.platform`.
2. Which executable path to use for the `isInstalled()` cache check and
for the `path.txt` marker written after extraction, via
`getPlatformPath()`.
`getPlatformPath()` was not updated with the rest of that change and
still falls back to `npm_config_platform || os.platform()` only.
As a result, passing `ELECTRON_INSTALL_PLATFORM` (as documented in
`docs/tutorial/installation.md`) causes the two to disagree: the
download fetches the requested platform's zip, but `path.txt` and the
path sanity check are written against the host platform's executable
name. That in turn makes `isInstalled()` always return `false` on
subsequent runs (forcing redundant re-downloads) and makes the
executable path recorded in `path.txt` wrong for the artifact that
was actually extracted (e.g. `electron` written alongside a
`darwin`/`win32` build).
Check `ELECTRON_INSTALL_PLATFORM` first, matching the resolution used
for `downloadArtifact`.
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
ckerr
pushed a commit
to erickzhao/ericktron
that referenced
this pull request
Apr 30, 2026
…#51029) The postinstall script resolves two things from the target platform: 1. Which artifact to download, via `downloadArtifact({ platform, ... })`. Since electron#49981, `platform` is derived from `ELECTRON_INSTALL_PLATFORM || npm_config_platform || process.platform`. 2. Which executable path to use for the `isInstalled()` cache check and for the `path.txt` marker written after extraction, via `getPlatformPath()`. `getPlatformPath()` was not updated with the rest of that change and still falls back to `npm_config_platform || os.platform()` only. As a result, passing `ELECTRON_INSTALL_PLATFORM` (as documented in `docs/tutorial/installation.md`) causes the two to disagree: the download fetches the requested platform's zip, but `path.txt` and the path sanity check are written against the host platform's executable name. That in turn makes `isInstalled()` always return `false` on subsequent runs (forcing redundant re-downloads) and makes the executable path recorded in `path.txt` wrong for the artifact that was actually extracted (e.g. `electron` written alongside a `darwin`/`win32` build). Check `ELECTRON_INSTALL_PLATFORM` first, matching the resolution used for `downloadArtifact`. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
jkleinsc
pushed a commit
that referenced
this pull request
May 5, 2026
…51370) * fix: honor `ELECTRON_INSTALL_PLATFORM` in `getPlatformPath` (#51029) The postinstall script resolves two things from the target platform: 1. Which artifact to download, via `downloadArtifact({ platform, ... })`. Since #49981, `platform` is derived from `ELECTRON_INSTALL_PLATFORM || npm_config_platform || process.platform`. 2. Which executable path to use for the `isInstalled()` cache check and for the `path.txt` marker written after extraction, via `getPlatformPath()`. `getPlatformPath()` was not updated with the rest of that change and still falls back to `npm_config_platform || os.platform()` only. As a result, passing `ELECTRON_INSTALL_PLATFORM` (as documented in `docs/tutorial/installation.md`) causes the two to disagree: the download fetches the requested platform's zip, but `path.txt` and the path sanity check are written against the host platform's executable name. That in turn makes `isInstalled()` always return `false` on subsequent runs (forcing redundant re-downloads) and makes the executable path recorded in `path.txt` wrong for the artifact that was actually extracted (e.g. `electron` written alongside a `darwin`/`win32` build). Check `ELECTRON_INSTALL_PLATFORM` first, matching the resolution used for `downloadArtifact`. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com> * run oxfmt --------- Signed-off-by: Asish Kumar <officialasishkumar@gmail.com> Co-authored-by: Asish Kumar <87874775+officialasishkumar@users.noreply.github.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Due to the binary no longer installing on
npm installand us getting warnings fromnpmfor setting unknown config values fornpm install --platform win32 electron, here are two new env vars:cc @electron/wg-api
Checklist
npm testpassesRelease Notes
Notes: added
ELECTRON_INSTALL_PLATFORMandELECTRON_INSTALL_ARCHvariables to install binaries from other platforms and architectures.