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
fix: Allow x64 arch on Mac Rosetta #32266
Conversation
If the npm_config_arch environment variable is set on Mac, then use the specified architecture rather than overriding it to x64.
💖 Thanks for opening this pull request! 💖 We 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:
Things 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. |
This would be very useful to have. It seems like the appveyor builds/tests fail are due to time/quota issues. |
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
I was unable to backport this PR to "14-x-y" cleanly; |
I have automatically backported this PR to "15-x-y", please check out #32380 |
I have automatically backported this PR to "16-x-y", please check out #32381 |
I have automatically backported this PR to "17-x-y", please check out #32382 |
If the npm_config_arch environment variable is set on Mac, then use the specified architecture rather than overriding it to x64.
This works but unfortunately the |
Description of Change
Closes #32147.
If the
npm_config_arch
environment variable is set on Mac, then use the specified architecture rather than overriding it to x64.Currently,
npm/install.js
overrides the architecture specified innpm_config_arch
to bearm64
when running on Mac Rosetta. However, this can break workflows that rely on specific architectures for compatibility with native addons. Some native addons do not yet provide prebuilds for Mac arm64, requiring the use of Electron x64. By installing native addons in a Rosetta environment, the correct x64 prebuilds will be used for native addons, butnpm/install.js
as written will force an install of arm64 Electron, which is incompatible with the x64 addons.Additionally, it's quite confusing that https://www.electronjs.org/docs/latest/tutorial/installation states the
npm_config_arch
flag can be used to specify an arch, but its value is ignored in Rosetta environments. It seems like the value of this flag should be respected if set, and a best guess can be made when it's not set. An alternative approach here would be to allow setting a third environment variable to prevent the override, but that seemed more confusing than respecting the value of the existing variable.If I've misunderstood anything above, do let me know!
Checklist
Release Notes
Notes: Allowed specifying x64 arch on Mac Rosetta via
npm_config_arch
.