npm / npm/cli

[BUG] `npm version` command does not respect `config set tag-version-prefix ""` since >= v9.6.5

Open
#6,719 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 9.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

Despite explicitly using npm config set tag-version-prefix "" before npm version <patch|minor|major>, the created git tag and resulting function output are still prefixed with v.

This behavior occurs in NPM v9.6.5 -> v9.8.1

Expected Behavior

Up until npm v9.6.5, when using npm config set tag-version-prefix "", the created git tag, git commit message and command output would all result in the new version without the v prefix.

Steps To Reproduce
  1. Create a new empty NPM project with npm init -y && git init
  2. Run npm config set tag-version-prefix ""
  3. Run npm version with either major,minor or patch
  4. Observe command output with v prefix
  5. Check git tags with git tag --list and observe created tag with v prefix
  6. Check git commit logs with git log and observe commit message of new version, without v prefix
Environment
  • npm: >= v9.6.5
  • Node.js: >= 18.16.0
  • OS Name: MacOS Ventura 13.4/Ubuntu 22.04.3
  • System Model Name: Macbook Pro 2019/GitHub Actions Runner 2.308.0
  • npm config:
; "user" config from /Users/calem.roelofs/.npmrc

//npm.pkg.github.com/:_authToken = (protected)

; node bin location = /Users/calem.roelofs/.nvm/versions/node/v18.16.0/bin/node
; node version = v18.16.0
; npm local prefix = /Users/calem.roelofs/Code/CalemRoelofs/testversion
; npm version = 9.6.5
; cwd = /Users/calem.roelofs/Code/CalemRoelofs/testversion
; HOME = /Users/calem.roelofs
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in an empty npm project using npm config set tag-version-prefix "" followed by npm version patch, minor, or major. Compare the command output, created Git tag, and commit message with the expected unprefixed version. The payload does not name a source file or test, so locating the versioning and tag-prefix handling will require repository research.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.