Skip to content

[BUG] npm version prerelease does not work with numeric --preid #3181

@ntkme

Description

@ntkme

Currently --preid only works correctly with non-numeric value. I have actually root caused it down to a bug in npm/node-semver and submitted a PR to fix it: npm/node-semver#380. I'm opening this issue for tracking purpose and hopefully to get some attention from the npm team.

Current Behavior:

Case 1:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.0"
}

$ npm version prerelease --preid 2021
npm ERR! Version not changed

Case 2:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.1"
}

$ npm version prerelease --preid 2021
v1.0.0-2021.0

Expected Behavior:

Case 1:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.0"
}

$ npm version prerelease --preid 2021
v1.0.0-2021.1

Case 2:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.1"
}

$ npm version prerelease --preid 2021
v1.0.0-2021.2

Environment:

$ node --version
v16.0.0
$ npm --version
7.10.0

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingEnhancementnew feature or improvementRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions