mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: warn about launch Chrome using Node x64 on arm64 Macs (#11471)
This commit is contained in:
parent
50695ec4d0
commit
957a8293bb
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {mkdtemp} from 'fs/promises';
|
import {mkdtemp} from 'fs/promises';
|
||||||
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -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);
|
return super.launch(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user