-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
Packages that use node-gyp-build
fail to install on node v20 when using yarn in the case where they don't bundle prebuilds for the platform already (i.e. when building is needed).
Using leveldown
as an example (but the same happens with sodium-native
, rocksdb
, node-lmdb
, etc):
$ docker run -it --rm -w /root node:20 /bin/bash
root@78779b01eaaf:~# npm_config_build_from_source=true yarn add leveldown
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /root/node_modules/leveldown: Command failed.
Exit code: 1
Command: node-gyp-build
Arguments:
Directory: /root/node_modules/leveldown
Output:
node:events:492
throw er; // Unhandled 'error' event
^
Error: spawn node-gyp ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn node-gyp',
path: 'node-gyp',
spawnargs: [ 'rebuild' ]
}
Node.js v20.5.1
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
root@78779b01eaaf:~#
Here the npm_config_build_from_source
env variable is set to true
to emulate the behaviour of --build-from-source
on NPM.
When no building is needed, everything works as expected:
$ docker run -it --rm -w /root node:20 /bin/bash
root@c7c921d3c316:~# yarn add leveldown
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 12 new dependencies.
info Direct dependencies
└─ leveldown@6.1.1
info All dependencies
├─ abstract-leveldown@7.2.0
├─ base64-js@1.5.1
├─ buffer@6.0.3
├─ catering@2.1.1
├─ ieee754@1.2.1
├─ is-buffer@2.0.5
├─ level-concat-iterator@3.1.0
├─ level-supports@2.1.0
├─ leveldown@6.1.1
├─ napi-macros@2.0.0
├─ node-gyp-build@4.6.0
└─ queue-microtask@1.2.3
Done in 3.72s.
root@c7c921d3c316:~#
Metadata
Metadata
Assignees
Labels
No labels