fix: Allow npm_config_arch override on mac (#32266)

If the npm_config_arch environment variable is set on Mac, then use the
specified architecture rather than overriding it to x64.
This commit is contained in:
Tommy MacWilliam 2022-01-07 00:53:15 -08:00 committed by GitHub
parent 7678a0aebb
commit 824c909e2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,8 @@ if (isInstalled()) {
const platform = process.env.npm_config_platform || process.platform;
let arch = process.env.npm_config_arch || process.arch;
if (platform === 'darwin' && process.platform === 'darwin' && arch === 'x64') {
if (platform === 'darwin' && process.platform === 'darwin' && arch === 'x64' &&
process.env.npm_config_arch === undefined) {
// When downloading for macOS ON macOS and we think we need x64 we should
// check if we're running under rosetta and download the arm64 version if appropriate
try {