Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

prebuild-install fails to determine target on Node 23.6.0 #203

Closed

Description

@baileympearson

On the latest node (23.6.0), prebuild-install fails to install native packages that specify napi versions in the package.json (and maybe other configurations too) - prebuild-install reports a target of undefined. Ex:

$ npm i @mongodb-js/zstd
npm error code 127
npm error path /~/dev/mongoose/node_modules/@mongodb-js/zstd
npm error command failed
npm error command sh -c prebuild-install --runtime napi || npm run clean-install
npm error > @mongodb-js/[email protected] clean-install
npm error > npm run install-zstd && npm run compile
npm error
npm error
npm error > @mongodb-js/[email protected] install-zstd
npm error > bash etc/install-zstd.sh
npm error prebuild-install warn This package does not support N-API version undefined
npm error prebuild-install warn install No prebuilt binaries found (target=undefined runtime=napi arch=arm64 libc= platform=darwin)
npm error bash: etc/install-zstd.sh: No such file or directory
npm error A complete log of this run can be found in: /~/.npm/_logs/2025-01-13T16_59_21_577Z-debug-0.log

(note: we realize that this package should be buildable from source, we plan to fix this separately).

Notice that the inferred target is undefined:

target=undefined runtime=napi arch=arm64 libc= platform=darwin)

This behavior is not present on Node versions <23.6.0.

The bug actually lies in napi-build-utils (I filed inspiredware/napi-build-utils#6 too) but that package seems long dead, so I'm filing an issue here as well.

The root cause is that 23.6.0 increased the napi version to 10, which breaks the logic in getBestNapiBuildVersion(), which uses string comparison instead of numeric comparison.

Activity

  1. jschlight commented on Jan 17, 2025

    @jschlight
    Contributor

    This issue should now be addressed in inspiredware/napi-build-utils 2.0.0.

  2. t3chguy commented on Feb 28, 2025

    @t3chguy

    This behavior is not present on Node versions <23.6.0.

    It also affects Node 22.14.0 LTS Jod

  3. vweevers commented on Feb 28, 2025

    @vweevers
    Member

    @t3chguy This has been fixed in 7.1.3. If you can still reproduce it then please open a new issue with details.

  4. t3chguy commented on Feb 28, 2025

    @t3chguy

    I'm aware, unfortunately https://github.com/atom/node-keytar is archived and won't receive the fix.

    Appreciate the fix but this caused major breakage that sows doubt in the ecosystem

    element-hq/element-desktop#2161

  5. vweevers commented on Feb 28, 2025

    @vweevers
    Member

    keytar depends on "prebuild-install": "^7.0.1" so that range includes the fixed version.

  6. vweevers commented on Feb 28, 2025

    @vweevers
    Member

    Lock files are not included in npm packages, so they don't apply here. They're only relevant on an application level.

  7. t3chguy commented on Feb 28, 2025

    @t3chguy

    You're right.

    Looks like the issue is down to prebuild having the same bad dependency in v11 which node-keytar depends on. Actually it still depends on the same broken version https://github.com/prebuild/prebuild/blob/master/package.json#L32

     ~/W/element-desktop   develop  cat .hak/keytar/aarch64-apple-darwin/build/node_modules/prebuild-install/package.json | jq .version                                    13.6s  Fri Feb 28 12:19:48 2025
    "7.1.3"
     ~/W/element-desktop   develop *  cat .hak/keytar/aarch64-apple-darwin/build/node_modules/prebuild-install/node_modules/napi-build-utils/package.json | jq .version            Fri Feb 28 12:29:47 2025
    "2.0.0"
     ~/W/element-desktop   develop  cat .hak/keytar/aarch64-apple-darwin/build/node_modules/napi-build-utils/package.json | jq .version                                            Fri Feb 28 12:20:07 2025
    "1.0.2"
    

    And I guess the wrong one is being resolved for whatever reason.

  8. vweevers commented on Feb 28, 2025

    @vweevers
    Member

    A pull request for prebuild would be welcome.

  9. t3chguy commented on Feb 28, 2025

    @t3chguy

    Wouldn't help node-keytar unless it was backported 2 major versions of prebuild :D

  10. vweevers commented on Feb 28, 2025

    @vweevers
    Member

    Yes, you'd have to fork it. That's just the way it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions