Posted 3 months ago. Visible to the public.

Pre-releasing an npm package

You can publish pre-release versions of an npm package.

Naming convention for pre-release versions

An npm package must use Semantic Versioning's naming convention for its version. In Semantic Versioning, the version number and pre-release identifier (like rc1) must be separated by a dash, like this:

  • 1.0.0-rc1
  • 2.3.0-alpha2
  • 3.0.0-beta3

Publishing to a pre-release tag

npm packages have multiple "current" releases, identified by "tags". The default tag is latest. It is expected to contain the latest stable version.

When you publish a pre-release version you want to publish to a different tag. This way users of latest don't automatically get your half-baked alpha versions when they upgrade. They need to explictily opt into pre-release versions, as shown below.

A popular tag for pre-releases is next. To publish to the next tag:

npm publish --tag next

Using pre-releases

npm will only install a pre-release if you explicitly use the next tag or name the version.

For instance, to install the latest version of foobar within the next tag:

"dependencies": { "foobar": "next" }

You may also name the pre-release version explicitly:

"dependencies": { "foobar": "^2.0.0-rc5" }

See also

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Henning Koch
Last edit:
3 months ago
by Henning Koch
prerelease, alpha, beta, rc
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more