Manage a Published npm Package

npm·2 min read·Jan 1, 2025

When updating a package, by adding a feature, refactoring the code, fixing a bug, etc, you need to update the package version before publishing it in order to reflect those changes.

Bump to a new version

To bump (or increase) a package version according the the semantic versioning (SemVer) rules, you can either manually edit the version field of the package.json file or use the npm version command within the package's directory:

$ npm version [<newversion> | major | minor | patch]

Where:

  • <newversion>: the new version number of the package (e.g., 2.2.3).
  • major: introduces a breaking change (e.g. 1.0.0 -> 2.0.0).
  • minor: introduces a new feature (e.g. 1.0.0 -> 1.1.0).
  • patch: introduces a bug fix (e.g. 1.0.0 -> 1.0.1).

For example:

$ npm version minor

Tag a published version

Tags are used to provide an alias instead of version numbers.

By default, the latest tag is used by npm to identify the latest published version of a package, which will be used by the npm install command if no version number or tag is provided.

Typically, projects only use the latest tag for stable release versions, and use other tags such as beta, dev, canary, etc., for unstable versions such as prereleases.

Unlock the program 🚀

Pay once, own it forever.

€79

30-day money-back guarantee

  • 13 modules
  • 113 lessons with full-code examples
  • 29 projects with commented solutions
  • All future lesson and project updates
  • Lifetime access

By submitting this form, you agree to the Terms & Conditions and Privacy Policy.