protoschool.github.io icon indicating copy to clipboard operation
protoschool.github.io copied to clipboard

Bug: npm install fails on Apple Silicon native nodejs

Open yusefnapora opened this issue 4 years ago • 4 comments

Describe the bug This is an edge case relating to running npm install in this repo when using a version of node that's been compiled to run natively on Apple's new chips. It's probably a low priority to fix, since if we wait long enough the puppeteer package that's failing will probably update with a fix. I thought it was worth making an issue to track though, in case anyone else is affected and wants a workaround.

Expected behavior npm install should build and install all dependencies.

To reproduce

On a Mac with an Arm chip, install nodejs from source. The easiest way to do this is probably using nvm.

Using the native nodejs, run npm install.

As of 2021-02-15, you get an error from the puppeteer package, which tries to download a copy of Chromium, but fails to find one for Arm Macs.

Additional context

There's an easy fix for this, which is to set an environment variable before running npm install to skip the chromium download:

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
npm install

Alternatively, you can just use an Intel build of nodejs through Rosetta, which will successfully download the Intel build of Chromium.

yusefnapora avatar Feb 15 '21 21:02 yusefnapora

upstream issue in puppeteer: https://github.com/puppeteer/puppeteer/issues/6622

yusefnapora avatar Feb 15 '21 21:02 yusefnapora

Thank you for the report! I think adding the fix to the troubleshooting section would be sensible: https://github.com/ProtoSchool/protoschool.github.io/blob/main/DEVELOPING_TUTORIALS.md#troubleshooting

Thoughts @terichadbourne ?

zebateira avatar Feb 16 '21 14:02 zebateira

@zebateira @yusefnapora Yes, if there are any installation issues that you expect to come up repeatedly and which we don't have the ability to fix in our own codebase, then adding suggestions would be great. Thanks!

The one caveat here is that you could hit that problem without trying to build a tutorial, just trying to proof for someone else, right? So perhaps we should link from the installation section of our main README to the troubleshooting section of the developing tutorials guide.

terichadbourne avatar Feb 26 '21 23:02 terichadbourne

The one caveat here is that you could hit that problem without trying to build a tutorial, just trying to proof for someone else, right? So perhaps we should link from the installation section of our main README to the troubleshooting section of the developing tutorials guide.

Sounds good 👍

zebateira avatar Mar 03 '21 11:03 zebateira