Skip to content

Commit

Permalink
fix: warn about launch Chrome using Node x64 on arm64 Macs (#11471)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Nov 30, 2023
1 parent 50695ec commit 957a829
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/puppeteer-core/src/node/ChromeLauncher.ts
Expand Up @@ -15,6 +15,7 @@
*/

import {mkdtemp} from 'fs/promises';
import os from 'os';
import path from 'path';

import {
Expand Down Expand Up @@ -64,6 +65,26 @@ export class ChromeLauncher extends ProductLauncher {
);
}

if (
this.puppeteer.configuration.logLevel === 'warn' &&
process.platform === 'darwin' &&
process.arch === 'x64'
) {
const cpus = os.cpus();
if (cpus[0]?.model.includes('Apple')) {
console.warn(
[
'\x1B[1m\x1B[43m\x1B[30m',
'Degraded performance warning:\x1B[0m\x1B[33m',
'Launching Chrome on Mac Silicon (arm64) from an x64 Node installation results in',
'Rosetta translating the Chrome binary, even if Chrome is already arm64. This would',
'result in huge performance issues. To resolve this, you must run Puppeteer with',
'a version of Node built for arm64.',
].join('\n ')
);
}
}

return super.launch(options);
}

Expand Down

0 comments on commit 957a829

Please sign in to comment.