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

No native build was found - Node v20.11.0 and node-gyp-build 4.8.0, 4.8.1 #413

Closed
gligorot opened this issue Aug 21, 2024 · 5 comments
Closed

Comments

@gligorot
Copy link

gligorot commented Aug 21, 2024

Hi,

We have an issue with using argon2 with version of Node after v20.2.0.
Also reproduced on v20.3.0, v20.11.0 (our default) and also the latest v20.16.0.

Problem

node_modules/argon2/build is missing - ie. argon2 didn't install properly but no errors are shown

Actual error (from our full project)

No native build was found for platform=darwin arch=arm64 runtime=node abi=115 uv=1 armv=8 libc=glibc node=20.11.0\n loaded from: xyz/node_modules/argon2\n",

Update (26.08.2024)

Fixating node-gyp-build to 4.7.1 fixes this issue. I'll open an issue over there.

package.json

// yarn
  "resolutions": {
    "node-gyp-build": "4.7.1"
  }

// npm 
 "overrides": {
   "node-gyp-build": "4.7.1"
  } 

Minimal reproduction steps

  1. Create a blank NPM project.
    note - same behavior with yarn
mkdir argon-test
cd argon-test
npm init
  1. Use Node v20.2.0
# set package.json to: (ie. use node 20.2.0, regardless if Volta or another way)

{
  "volta": {
    "node": "20.2.0"
  }
}
  1. Install argon with Node v20.2.0
npm add argon2
ls node_modules/argon2 -> "build" folder exists
  1. Uninstall argon
npm remove argon2
  1. Reinstall argon with Node v20.11.0 (or 20.3.0, or 20.16.0)
# set package.json to: (ie. use node 20.11.0, but 20.3.0 has same result)

{
  "volta": {
    "node": "20.11.0"
  }
}

npm add argon2
ls node_modules/argon2 -> "build" folder DOESN'T exist

Expected behaviour

node_modules/argon2/build is always present, regardless of the specific Node 20 version

Other details

The resolved version of argon2 in both cases is:

    "node_modules/argon2": {
      "version": "0.40.3",

Actual behaviour

Tell us what happens instead

Environment

Operating system:
Sonoma 14.6.1 (23G93).
Apple Silicon (M1 Pro).

Node version:

  • working: 20.2.0
  • not working: 20.3.0, 20.11.0, 20.16.0

Package manager version:

Other relevant versions:
Python: 3.12, installed via pyenv (assuming it matters for node-gyp)

@gligorot
Copy link
Author

U:
Tested also with python 3.10.14, 2.7.18 with the same results.

@gligorot gligorot changed the title Apple Silicon: "build" folder missing from node_modules/argon2/ on Node v20.11.0 No native build was found - Node v20.11.0 and node-gyp-build 4.8.1 Aug 26, 2024
@gligorot gligorot changed the title No native build was found - Node v20.11.0 and node-gyp-build 4.8.1 No native build was found - Node v20.11.0 and node-gyp-build 4.8.0, 4.8.1 Aug 26, 2024
@gligorot
Copy link
Author

U: node-gyp-build: 4.8.0 doesn't work either, so the issue is somewhere in this 2 line change?
prebuild/node-gyp-build@v4.7.1...v4.8.0

@gligorot
Copy link
Author

tl;dr issue was with yarn and our yarn.lock file.

We had two separate node-gyp-build versions requested (as dependency of dependecy):

❯ yarn why node-gyp-build
├─ @parcel/watcher@npm:2.0.4
│  └─ node-gyp-build@npm:4.5.0 (via npm:^4.3.0)
│
├─ argon2@npm:0.40.3
│  └─ node-gyp-build@npm:4.8.1 (via npm:^4.8.0)
│
└─ leveldown@npm:6.1.1
   └─ node-gyp-build@npm:4.5.0 (via npm:^4.3.0)

This resolved to 2 different versions in yarn.lock:

"node-gyp-build@npm:^4.3.0":
version: 4.5.0
resolution: "node-gyp-build@npm:4.5.0"
...

"node-gyp-build@npm:^4.8.0":
version: 4.8.1
resolution: "node-gyp-build@npm:4.8.1"
...

But only one was installed:

cat node_modules/node-gyp-build/package.json | grep version // => "version": "4.5.0",

The fix

yarn dedupe node-gyp-build

Now only one version is correctly resolved and installed:

cat node_modules/node-gyp-build/package.json | grep version # => "version": "4.8.1",

And we correctly use a prebuilt binary.

@ranisalt
Copy link
Owner

@gligorot if you're using yarn 3 or 4, for some reason they don't dedupe anymore when installing, and it leads to a shitload of duplicate dependencies. In my company we added yarn dedupe --check as part of the pull request checks to make sure it doesn't happen, since duplicate dependencies cause a myriad of issues.

@gligorot
Copy link
Author

gligorot commented Sep 2, 2024

@ranisalt Good point, I'll integrate this on our side as well. Thanks for the input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants