Repository navigation
fix: make ELECTRON_OVERRIDE_DIST_PATH work on macOS and Windows - #55403
Merged
MarshallOfSound merged 1 commit intoNov 10, 2026
Merged
MarshallOfSound merged 1 commit into
MarshallOfSound merged 1 commit into
Conversation
npm/index.js joins ELECTRON_OVERRIDE_DIST_PATH with the executable path listed in path.txt, and falls back to a bare "electron" when there is no path.txt (added in electron#25377 for installs that skip scripts). That is only the right file name on Linux. The executable is Electron.app/Contents/MacOS/Electron on macOS and electron.exe on Windows. Since electron#49328 removed the postinstall script, path.txt does not exist until the binary is first downloaded, so a fresh install with the override set always hits that fallback. The override also skips the download, so require('electron') and the electron command kept pointing at a file that does not exist. Fall back to the executable path of the current platform instead, and add a spec for how npm/index.js resolves the executable path. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
MarshallOfSound
approved these changes
Oct 29, 2026
MarshallOfSound
enabled auto-merge (squash)
October 29, 2026 07:55
jkleinsc
approved these changes
Nov 10, 2026
|
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.
Description of Change
npm/index.jsjoinsELECTRON_OVERRIDE_DIST_PATHwith the executable path listed inpath.txt, and falls back to a bareelectronwhen there is nopath.txt. That fallback came with #25377, for installs that skip scripts, and it is only the right file name on Linux: the executable isElectron.app/Contents/MacOS/Electronon macOS andelectron.exeon Windows.Since #49328 removed the
postinstallscript,path.txtdoesn't exist until the binary is first downloaded. A fresh install with the override set therefore always hits the fallback, and because the override returns before any download, nothing ever writespath.txteither.require('electron')and theelectroncommand end up pointing at a file that doesn't exist.This falls back to the executable path of the current platform instead. An existing
path.txtstill takes precedence, as before. The fallback usesprocess.platformrather thanELECTRON_INSTALL_PLATFORM/npm_config_platform, whichinstall.jshonors when choosing what to download, because the override is a build that runs on this machine.On macOS (arm64), with a fresh
[email protected]install that hasn't downloaded anything, andELECTRON_OVERRIDE_DIST_PATHpointing at an extracted Electron 45.0.0 distribution:electron --versionError: spawn …/electron ENOENTv45.0.0I added
spec/npm-package.spec.ts, which covers hownpm/index.jsresolves the executable path: with the override and nopath.txt, with the override and apath.txt, and without the override. I ran it withnode script/spec-runner.js --electronVersion=45.0.0 --skipYarnInstall --files spec/npm-package.spec.tson macOS (arm64). It passes with this change, and without it the override test fails (expected…/Electron.app/Contents/MacOS/Electron, received…/electron) while the other two pass. I haven't run the full suite, and the spec hasn't run on Windows or Linux yet.I kept the platform mapping inside
index.jsinstead of sharing the one ininstall.jsthrough a new file, because I can't see how the files innpm/are assembled for publishing. A shared module would avoid the duplicatedswitch, if a new file is safe to add. I didn't find an existing issue for this. It relates to #49900, but it doesn't add tests for the download itself.This change was prepared with Claude Code (Claude Sonnet 5.5), as noted in the
Co-Authored-Bytrailer.🤖 Generated with Claude Code
Checklist
Release Notes
Notes: Fixed
ELECTRON_OVERRIDE_DIST_PATHnot working on macOS and Windows.