Vineesh
Vineesh

Reputation: 3782

Node module versioning

I have a node module for example demo-npm-module. The module has different versions published to npm. For example

1.0.0
1.1.0
2.0.0
3.0.0

I want to make some bug fix in an older version for example 1.1.0 , then the version will be updated to 1.1.1. I made this change and published to npm. Now the problem is after publishing version 1.1.1 this becomes the latest version. If I do npm install demo-npm-module now it will install version 1.1.1 instead of the actual latest version which is 3.0.0.

Is there any solution to publish changes to an older version and increment the patch/minor version number of node package without making it the latest version?

Upvotes: 1

Views: 43

Answers (1)

Mehdi
Mehdi

Reputation: 7403

Have a look at the documentation for npm publish.

By default, npm assigns the tag latest to the release you publish.

An by default, npm install looks up for the version containing tag latest.

You can work around this by defining your own tag, in such case, you may use v1 for the whole set of versions 1.x.y.

npm publish --tag v1

Mike Bostock, a javascript developer, wrote an article detailing this a while ago, it's worth having a look at it: Prereleases and Npm.

Upvotes: 1

Related Questions