Skip to content

getBestNapiBuildVersion() fails on Node 23.6.0 #6

Closed

Description

@baileympearson

Node 23.6.0 increased the napi version to 10 - the first napi version to have double digits. This causes getBestNapiBuildVersion (and perhaps other functions too) to fail to produce the correct version:

$ cat package.json | jq '.binary' 
{
  "napi_versions": [
    4
  ]
}
$ node --version
v23.5.0
$ node -p "require('napi-build-utils').getBestNapiBuildVersion()"
4
$ nvm use 23.6.0
$ node --version                                                 
v23.6.0
$ node -p "require('napi-build-utils').getBestNapiBuildVersion()"
undefined

The root cause is string comparison instead of numeric comparison - until we reached 10, when napiBuildVersion <= ourNapiVersion compared strings, the result was the same as though they were numbers. Now its using lexographic comparison, and napiBuildVersion <= ourNapiVersion -> '4' <= '10' -> 'false'.

Activity

  1. self-assigned this
    on Jan 13, 2025
  2. added 8 commits that reference this issue on Jan 13, 2025
    7fa7a2f
    98fa3e9
    99ff9a5
    1bfd1c4
    9d3740d
    4465612
    9852698
    8377c1c
  3. jschlight commented on Jan 17, 2025

    @jschlight
    Member

    This issue should now be addressed in 2.0.0.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions