fix: honor ELECTRON_INSTALL_PLATFORM in getPlatformPath (#51029)#51370
Merged
Conversation
5 tasks
ckerr
approved these changes
Apr 28, 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>
e1b5141 to
14310cb
Compare
VerteDinde
approved these changes
May 4, 2026
jkleinsc
approved these changes
May 5, 2026
Member
|
Merging as CI failure unrelated to PR change. |
|
Release Notes Persisted
|
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.
Backport of #51029
See that PR for details.
Notes: Fixed ELECTRON_INSTALL_PLATFORM being ignored when resolving the Electron executable path during postinstall, which caused path.txt to be written for the host platform instead of the requested target and made isInstalled() always re-download on subsequent installs.