Skip to content
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

Can't install package on Macbook M1 (puppeteer/chromium) #1463

Closed
AaronDavidNewman opened this issue Oct 18, 2022 · 6 comments
Closed

Can't install package on Macbook M1 (puppeteer/chromium) #1463

AaronDavidNewman opened this issue Oct 18, 2022 · 6 comments
Labels

Comments

@AaronDavidNewman
Copy link
Collaborator

ARM silicone macbook. npm install of latest vexflow gives the following error. Apparently there is no chromium for the M1. Is it possible to install without the chromium option?

I've read various workarounds, they all sound complicated and not really clear how to get it to work with this project. Wondering if anyone has solved this before I go down the rabbit hole.

ANEWMAN-202207:vexflow anewman$ npm install
npm ERR! code 1
npm ERR! path /Users/anewman/src/github/vexflow/node_modules/grunt-contrib-qunit/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c -- node install.js
npm ERR! The chromium binary is not available for arm64: 
npm ERR! If you are on Ubuntu, you can install with: 
npm ERR! 
npm ERR!  apt-get install chromium-browser
npm ERR! 
npm ERR! /Users/anewman/src/github/vexflow/node_modules/grunt-contrib-qunit/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:112
npm ERR!             throw new Error();
npm ERR!             ^
npm ERR! 
npm ERR! Error
npm ERR!     at /Users/anewman/src/github/vexflow/node_modules/grunt-contrib-qunit/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:112:19
npm ERR!     at FSReqCallback.oncomplete (node:fs:202:21)

@rvilarl
Copy link
Collaborator

rvilarl commented Oct 18, 2022

@ronyeh can you look into that?

@ronyeh
Copy link
Collaborator

ronyeh commented Oct 18, 2022

Oh, interesting. Unfortunately I have an Intel Macbook.

There should be an option in puppeteer to use the local installation of Chrome, right? Can you figure out how to set puppeteer to point to the Chrome in your /Applications/ folder? Then maybe we can do a PR where we add that flag on M1/M2 Macs (and any computer where npm install of Chromium fails).

@ronyeh
Copy link
Collaborator

ronyeh commented Oct 18, 2022

LaunchOptions.executablePath property

Path to a browser executable to use instead of the bundled Chromium. Note that Puppeteer is only guaranteed to work with the bundled Chromium, so use this setting at your own risk.

@ronyeh
Copy link
Collaborator

ronyeh commented Oct 18, 2022

Some comments that might be relevant:

puppeteer/puppeteer#6622 (comment)

puppeteer/puppeteer#6622 (comment)

This last one has some useful steps to try.

puppeteer/puppeteer#6622 (comment)

Some of the steps include:

  • export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true. This will allow puppeteer to install.
  • npm install puppeteer. It will skip trying to download chromium and install correctly.
  • At this point, trying to run puppeteer (for me, using the command npm run test) gives the following error: Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT
  • brew install chromium then run which chromium to make sure it installed properly, it should output the path to the new Chromium executable.
  • ....

@ronyeh ronyeh added the 4.1 label Oct 18, 2022
@AaronDavidNewman
Copy link
Collaborator Author

Thanks, I got it working. The 'PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true' trick worked for puppeteer.

The second issue I had was with canvas. Installing canvas failed, and I had to install 'brew' and a bunch of other tools:

brew install pkg-config cairo pango libpng jpeg giflib librsvg

I think I had the same trouble on Ubuntu, now that I think of it.

I haven't done the chromium step yet since I don't need to create diffs right now, but I will probably take it up eventually. This machine is crazy fast, if I can figure out how it works.

@write2aj
Copy link

write2aj commented Nov 8, 2022

You could try installing chromium using brew.
For my Mac M1 with macOS 12.6 it got installed using the below brew install.
brew install chromium --no-quarantine which installs it at - /opt/homebrew/bin/chromium and has the Chromium app in Applications folder as well.

Note - without the --no-quarantine MacOS's Gatekeeper prevents the app from running.

Hope this helps!

@rvilarl rvilarl closed this as completed Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants