Skip to content

Fails on node@20  #16

@evilru

Description

@evilru
$ npx version-from-git --no-git-tag-version --allow-same-version --template short
Running version-from-git@1.1.1
Reading from C:\project\package.json
Bumping from 1.0.0-4a890eb to 1.0.0-4a890eb
Running npm version --allow-same-version --no-git-tag-version 1.0.0-4a890eb
v1.0.0-4a890eb
node:internal/validators:95
      throw new ERR_INVALID_ARG_TYPE(name, 'number', value);
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received an instance of Object
    at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
    at process.exit (node:internal/process/per_thread:188:24)
    at main (C:\project\node_modules\version-from-git\src\index.js:101:11)
    at Object.<anonymous> (C:\project\node_modules\version-from-git\src\index.js:104:1)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.5.1

spawn.sync returns an object
https://nodejs.org/api/child_process.html#child_processspawnsynccommand-args-options
https://github.com/compulim/version-from-git/blob/master/src/index.js#L99

where process.exit expects a number as parameter
https://nodejs.org/api/process.html#processexitcode
https://github.com/compulim/version-from-git/blob/master/src/index.js#L101

It looks like with node@20, the input validation became stricter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions