npm version Explained
What npm version does, with an example.
Published November 12, 2026
npm version bumps the version in package.json (patch, minor, major, or a specific number), creates a git commit and tag, and keeps releases consistent with semantic versioning.
How it works
patch for fixes, minor for features, major for breaking changes. Pre-release options include prepatch and prerelease --preid=beta.
It requires a clean git working tree by default.
Try it
npm version minor
v1.3.0
git tag
v1.3.0
Practical examples
Bump versions
npm version patch
npm version minor
npm version majorExact version
npm version 2.0.0Pre-release
npm version prerelease --preid=betaWithout git tag
npm version patch --no-git-tag-versionCommon mistakes
- Running with uncommitted changes.
- Bumping the wrong level.
- Forgetting to push tags (git push --follow-tags).
Key takeaways
- npm version bumps the version in package.json (patch, minor, major, or a specific number), creates a git commit and tag, and keeps releases consistent with semantic versioning.
- Run npm help <command> for every option.
- Commit package-lock.json.
FAQ
Skip the commit?
Use --no-git-tag-version.
Does this work with yarn or pnpm?
They have equivalents with similar commands.