node-argon2 icon indicating copy to clipboard operation
node-argon2 copied to clipboard

Build fails on Node 16.4 ARM M1

Open stevenmunro opened this issue 3 years ago • 25 comments

I note there are new ARM builds but trying yarn add argon2 fails on my system.

Big Sur 11.3 Node v16.4.0

Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | arm64
node-pre-gyp info check checked for "/Volumes/Samsung 850PRO/NEXTJS_Sites/restaurant/node_modules/argon2/lib/binding/napi-v3/argon2.node" (not found)
node-pre-gyp http GET https://github.com/ranisalt/node-argon2/releases/download/v0.28.2/argon2-v0.28.2-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.28.2/argon2-v0.28.2-napi-v3-darwin-arm64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v93 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.28.2/argon2-v0.28.2-napi-v3-darwin-arm64-unknown.tar.gz
[...] 

stevenmunro avatar Jun 29 '21 23:06 stevenmunro

Odd, indeed there is no Darwin ARM64 build even though we have it in the pipeline

image

Meanwhile, try using npm rebuild argon2 --build-from-source to recompile it. You need a C++ compiler installed.

ranisalt avatar Jun 30 '21 08:06 ranisalt

Indeed, we build for ARM64 and for OS X but not for OS X on ARM64 together. I don't even think it is feasible, as GitHub Actions run on x86 and the run-on-arm64 action does not support OS X. For the time being, you will have to rebuild from sources.

ranisalt avatar Jun 30 '21 08:06 ranisalt

There's an open issue for M1 support on github actions: https://github.com/actions/virtual-environments/issues/2187

It looks like there hasn't been any updates on it since December of last year.

nVitius avatar Jul 30 '21 00:07 nVitius

so any updates about arm64 ?

SirawichDev avatar Nov 23 '21 12:11 SirawichDev

anything?

partyconfetti avatar Dec 17 '21 14:12 partyconfetti

Anything?

power-f-GOD avatar Jan 08 '22 03:01 power-f-GOD

To solve this problem, I downgrade my node version to v14 by using nvm :

nvm install 14 
nvm use 14

maxgfr avatar Jan 17 '22 16:01 maxgfr

any news ? Rebuild from source does not work unfortunately.

zikster3262 avatar Jan 22 '22 10:01 zikster3262

Still fails on node v16.7.0

Tooluloope avatar Jan 22 '22 12:01 Tooluloope

No development from Github on supporting M1 for Actions, so no progress on this issue yet :(

ranisalt avatar Jan 23 '22 16:01 ranisalt

The package sharp has an ARM build, it says MacStadium but maybe you can try it out? You can checkout the commit here: https://github.com/lovell/sharp/commit/21d1a7ca620fe667fb7dd463cc2fcc80ffebc2e4

Also seems like MacStadium is supporting open source projects! https://www.macstadium.com/opensource

partyconfetti avatar Jan 27 '22 11:01 partyconfetti

Thanks for all the hard work @ranisalt! Any update on this?

Any possibility this could accelerate the timeline? Looks very promising and apparently usable today. https://github.com/hkratz/gha-runner-osx-arm64/pull/2

Collection of some other related threads: https://github.com/gitx/gitx/issues/289


Currently node-argon2 is the only dependency holding us back from support for Apple M1 platforms, so please let me know if there's anything we can do to help!

Nantris avatar Mar 01 '22 23:03 Nantris

@Slapbox definitely, will keep track of these in order to support ARM64 OS X as soon as possible.

ranisalt avatar Mar 04 '22 19:03 ranisalt

Note on node-gyp fails. Apparently, I've been using my old .npmrc file from my old non-M1 computer, and it had a node_gyp=[definitely not existing path] line in it. This was preventing yarn from building the package. Hope this helps someone!

partyconfetti avatar Mar 04 '22 20:03 partyconfetti

This still doesn't install on M1 Macs a year later.

I hope that this is given a higher priority. In the meantime I guess I'll use bcrypt.

Moebits avatar Apr 06 '22 18:04 Moebits

@Tenpi in theory you should be able to build the package from source on M1 machines. It's really just those of us without M1 machines that are out of luck for now.

Nantris avatar Apr 06 '22 19:04 Nantris

This still doesn't install on M1 Macs a year later.

You should be able to install it from source as @Slapbox mentioned. It is a priority to get it working decently on every major platform but this project doesn't really have the resources to do so swiftly :(

ranisalt avatar Apr 06 '22 21:04 ranisalt

M1 chips have made trouble for many projects. It's hardly something node-argon2 is alone in.

Is there anything the users of this project can do to help accelerate the process?

Nantris avatar Apr 06 '22 23:04 Nantris

Donate a M1 to me so I can work around that :laughing: but seriously, I applied to MacStadium as per @partyconfetti suggestion, and hopefully the workflow used by sharp can be just copy-pasted.

ranisalt avatar Apr 07 '22 11:04 ranisalt

Compiling arm64 images for Darwin (Mac) is also possible on intel with cross compilation.

Check some of the other projects that does that already, like: https://github.com/lovell/sharp-libvips/blob/main/.github/workflows/build-release.yml

How it is done: https://github.com/lovell/sharp-libvips/pull/74

gpetrov avatar May 07 '22 09:05 gpetrov

@ranisalt - Does this get us any closer? https://github.com/actions/runner/pull/1618#issuecomment-1133366112

Nantris avatar May 21 '22 21:05 Nantris

@ranisalt did you ever hear back about your MacStadium application? Any news on this generally?

I hate to keep bumping this thread, but I also dislike that our installer size is 500mb for macOS users (certainly not saying that's your fault - I am very grateful for your work.) I'm eagerly anticipating the day node-argon2 can have a prebuilt binary for ARM-based macOS devices.

Nantris avatar Jun 16 '22 21:06 Nantris

@Slapbox I got an approval from MacStadium a couple of days ago, but I'm on vacation for this week, after that I'll be able to work on it - and it shouldn't be very long since you guys helped a lot already :)

If you prefer, you can open a pull request configuring it and I will set up the token when needed.

ranisalt avatar Jun 19 '22 19:06 ranisalt

If you can afford to upgrade, using Node 18.1.0 fixed the issue for me. Rebuilding from source wasn't doing the trick.

Shiinoya avatar Jun 24 '22 15:06 Shiinoya

Any updates @ranisalt? Not to rush you of course; I super appreciate that you even shared this project to begin with! A few macOS users are dismayed at the giant size of the dual-architecture installer we're distributing in the meanwhile which got this back on my radar.

If I had any experience with MacStadium I'd be happy to help with a PR, but sadly I haven't got a clue.

Nantris avatar Aug 09 '22 23:08 Nantris

@Slapbox I'm working on that now on the macos-m1 branch. MacStadium has answered me ~~quite a while ago, but I was super busy changing jobs~~ and now I'm setting up the runner to test, build & deploy the M1 (and possibly M2) versions.

ranisalt avatar Aug 19 '22 23:08 ranisalt

Here we go! Please help me test v0.29.0

ranisalt avatar Aug 22 '22 22:08 ranisalt

Thank you so much for your outstanding work @ranisalt! I finally got a chance to give this a try and it's looking great!

Nantris avatar Sep 07 '22 23:09 Nantris

Macbook Pro M2 2022 user here - still getting following error: 'node_modules/argon2/lib/binding/napi-v3/argon2.node' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))

I tried it with using v0.29.0 but sadly it didn't work, even with v0.29.1


Fixed this by changing my architecture with following commands (using nvm):

necmi@MBP-von-Necmi gc-backend % arch -x86_64 zsh
necmi@MBP-von-Necmi gc-backend % nvm uninstall v16.14.2
Uninstalled node v16.14.2
necmi@MBP-von-Necmi gc-backend % nvm install v16.14.2

It should install (depending on your system) https://nodejs.org/dist/v18.9.0/node-v18.9.0-darwin-x64.tar.xz instead of https://nodejs.org/dist/v18.9.0/node-v18.9.0-darwin-arm64.tar.xz

necm1 avatar Sep 19 '22 11:09 necm1

@necm1 this is an upstream issue, it is @mapbox/node-pre-gyp that decides what prebuilt to install. Can you open an issue there and link back so we can track it?

ranisalt avatar Sep 19 '22 13:09 ranisalt