Skip to content

Commit

Permalink
feat: support fetching and launching on Apple M1
Browse files Browse the repository at this point in the history
  • Loading branch information
alex2844 authored and mathiasbynens committed Jan 8, 2021
1 parent 50b810d commit 9a8479a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
13 changes: 9 additions & 4 deletions src/node/BrowserFetcher.ts
Expand Up @@ -111,10 +111,15 @@ function downloadURL(
function handleArm64(): void {
fs.stat('/usr/bin/chromium-browser', function (err, stats) {
if (stats === undefined) {
console.error(`The chromium binary is not available for arm64: `);
console.error(`If you are on Ubuntu, you can install with: `);
console.error(`\n apt-get install chromium-browser\n`);
throw new Error();
fs.stat('/usr/bin/chromium', function (err, stats) {
if (stats === undefined) {
console.error(`The chromium binary is not available for arm64.`);
console.error(`If you are on Ubuntu, you can install with: `);
console.error(`\n sudo apt install chromium\n`);
console.error(`\n sudo apt install chromium-browser\n`);
throw new Error();
}
});
}
});
}
Expand Down
14 changes: 8 additions & 6 deletions src/node/Launcher.ts
Expand Up @@ -104,12 +104,14 @@ class ChromeLauncher implements ProductLauncher {
}

let chromeExecutable = executablePath;
if (os.arch() === 'arm64') {
chromeExecutable = '/usr/bin/chromium-browser';
} else if (!executablePath) {
const { missingText, executablePath } = resolveExecutablePath(this);
if (missingText) throw new Error(missingText);
chromeExecutable = executablePath;
if (!executablePath) {
if (os.arch() === 'arm64') {
chromeExecutable = '/usr/bin/chromium-browser';

This comment has been minimized.

Copy link
@rheinardkorf

rheinardkorf Feb 1, 2021

See #6641

This incorrectly assumes the location of Chromium. /usr/bin is discouraged as of Big Sur and in a default installation is not permitted to be used, even as sudo user.

This comment has been minimized.

Copy link
@Lxstr

Lxstr Feb 5, 2021

Yes please this is so frustrating. I want to install puppeteer on M1 Mac and going in circles.

} else {
const { missingText, executablePath } = resolveExecutablePath(this);
if (missingText) throw new Error(missingText);
chromeExecutable = executablePath;
}
}

const usePipe = chromeArguments.includes('--remote-debugging-pipe');
Expand Down

0 comments on commit 9a8479a

Please sign in to comment.