Setting NPM Version Without 'v' Prefix

Published on · Updated on
2 min read.
Tags: GitHubGit

By default, npm version creates git tags like v1.2.3. Some teams want plain tags like 1.2.3.

You can change that behavior with one config setting.

Command to remove v prefix

Run this in your project:

echo 'tag-version-prefix=""' >> .npmrc

Do not use npm config set tag-version-prefix "". With an empty value, npm deletes the key instead of saving it, so nothing changes.

After that, npm version patch will create tag format like 1.2.4 instead of v1.2.4.

Verify it works

  1. bump version:
npm version patch
  1. check latest git tag:
git tag --sort=-creatordate | head -n 3

You should see numeric tags without v.

Local vs global config

Project-only config is the .npmrc in your project root, as shown above. Commit it so the whole team gets it.

Config for every project on your machine:

echo 'tag-version-prefix=""' >> ~/.npmrc

For team consistency, project-level config is usually safer.

CI and release note

If your release pipeline expects v* tags, changing this may break automation. Check your CI scripts first.

Things to confirm:

  • changelog generator tag pattern
  • deploy workflow trigger pattern
  • semantic-release or custom release scripts

Rollback command

If you want default behavior again:

npm config delete tag-version-prefix --location=project

Use --location=user if you set it in ~/.npmrc. Then tags return to v1.2.3 style.