node-argon2: Build fails on Node 16.4 ARM M1

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 node-pre-gyp@1.0.5
node-pre-gyp info using node@16.4.0 | 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 argon2@0.28.2 and node@16.4.0 (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
[...] 

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 38 (12 by maintainers)

Most upvoted comments

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

@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.

Here we go! Please help me test v0.29.0

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

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

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

nvm install 14 
nvm use 14

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.

@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?

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

Standing by to smash the thumbs up button on that issue when you’ve created it @necm1.

@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.

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!

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 😦