Version Management in NPM
From the NPM Package Manager cheat sheet ยท Publishing & Versioning ยท verified Jul 2026
Version Management
Semantic versioning and releases
bash
# Bump version (updates package.json)
npm version patch # 1.0.0 -> 1.0.1
npm version minor # 1.0.0 -> 1.1.0
npm version major # 1.0.0 -> 2.0.0
# Specific version
npm version 1.2.3
# Prerelease versions
npm version prerelease # 1.0.0 -> 1.0.1-0
npm version prerelease --preid=beta # 1.0.1-beta.0
# With git tag
npm version patch -m "Release v%s"
# Without git tag
npm version patch --no-git-tag-version๐ข Essential - Follow semantic versioning
๐ก Major: breaking, Minor: features, Patch: fixes
๐ Version command creates git tag automatically
โก Use preversion script to run tests first
๐ Related: standard-version, semantic-release
versionsemver