webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

Install node modules fails on arm architecture

Open BenjaminButon opened this issue 3 years ago • 7 comments

Version

5.24.0

Operating System

MacOS on Apple Silicon

Browser

Not a browser issue

What steps will reproduce the bug?

Install node modules. It fails due to puppeteer can't be build on arm architecture

What is the expected behavior?

Node modules are installed successfully.

What do you see instead?

Node module installation fails

Additional information

Puppeteer npm package can't be built on arm architecture. image

Possible solution

There is an option to install packages using Rosetta2. To do so you can follow this instruction. But I think it's not the best solution because I'm sure a lot of people use the cmd line from IDE, for example, where you can't run it using Rosetta.

BenjaminButon avatar Mar 09 '22 11:03 BenjaminButon

Hi! Thanks for submitting this issue ... could you give us a bit more information here ... I have successfully installed node modules a few times successfully on an M1 Mac, so I'm wondering if there's something else going on here.

endymion1818 avatar Mar 09 '22 11:03 endymion1818

@endymion1818 See this thread for more information https://webiny-community.slack.com/archives/C014Y0HGJ0Y/p1646675978020979

BenjaminButon avatar Mar 09 '22 12:03 BenjaminButon

Hi! Thanks for submitting this issue ... could you give us a bit more information here ... I have successfully installed node modules a few times successfully on an M1 Mac, so I'm wondering if there's something else going on here.

Have you done it on 5.24.0? It does not appear before this.

timruppert avatar Mar 09 '22 12:03 timruppert

➜  blog-for-frontend-starter-kits git:(master) yarn webiny --version
5.24.0

Screen Shot 2022-03-09 at 13 10 01

endymion1818 avatar Mar 09 '22 13:03 endymion1818

I have, but I believe its because I installed it whilst in a terminal running Rosetta

➜  ~ node -v
v14.19.0
➜  ~ node       
Welcome to Node.js v14.19.0.
Type ".help" for more information.
> require("process").arch
'x64'

Otherwise if you see arm64 when you enter require("process").arch into the node repl you aren't running Rosetta.

Here's how to open a terminal in Rosetta once its installed if it helps:

Screenshot_2021-06-11_at_12 07 42_PM

If you do that and then install the Node binary we believe you should be able to install dependencies.. I'm afraid the other solution is a lot more complex because we're not sure which dependency of puppeteer would need to be updated in order to work natively.

endymion1818 avatar Mar 09 '22 14:03 endymion1818

I have, but I believe its because I installed it whilst in a terminal running Rosetta

➜  ~ node -v
v14.19.0
➜  ~ node       
Welcome to Node.js v14.19.0.
Type ".help" for more information.
> require("process").arch
'x64'

Otherwise if you see arm64 when you enter require("process").arch into the node repl you aren't running Rosetta.

Here's how to open a terminal in Rosetta once its installed if it helps:

Screenshot_2021-06-11_at_12 07 42_PM

If you do that and then install the Node binary we believe you should be able to install dependencies.. I'm afraid the other solution is a lot more complex because we're not sure which dependency of puppeteer would need to be updated in order to work natively.

Thanks endymion1818. Ostap - let's discuss whether this can get you past this or it will have other ramifications elsewhere.

timruppert avatar Mar 11 '22 15:03 timruppert

Another option is to override Puppeteer's setup behavior as described in this Slack Overflow answer.

  1. Install chromium via homebrew: brew install chromium
  2. Set the following environment variables in your shell config (e.g., .zshrc or .bashrc`)
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=`which chromium`

Now the install should pass.

blimmer avatar May 08 '22 01:05 blimmer

Instead of assigning ENV variables, I found a better way, using puppeteer-core package, which by definition doesn't download binaries. That's exactly what we need, since we don't even need those binaries locally.

Pavel910 avatar Aug 16 '22 10:08 Pavel910

@BenjaminButon take a look at this and let's see if this gets you past it.

timruppert avatar Aug 23 '22 07:08 timruppert