34
votes

If I modify my readme for an npm package I maintain, do I need to bump the version in package.json and do another npm publish? or is there another way to update the readme without a version bump.

4

4 Answers

41
votes

Depending on your definition of "need to", this could be two very different questions:

  1. [Is it ok to publish readme changes without bumping the version number?]

  2. [Is it technically possible to publish changes without incrementing the version]

The accepted answer (updating via npm publish --force, i.e. without incrementing any part of the version number) is a good answer to Q2. But I want to address Q1.

Use of npm publish --force is discouraged. Instead, authors are encouraged to use semantic versioning aka semver, which prescribes:

... version format of X.Y.Z (Major.Minor.Patch). Bug fixes not affecting the API increment the patch version, backwards compatible API additions/changes increment the minor version, and backwards incompatible API changes increment the major version.

So my answer is: While there is technically a way to publish changes without a version bump, you shouldn't do that. For minor edits that don't affect the package's API, you should bump the "patch" version, e.g. from 1.2.0 to 1.2.1.

2
votes

npm publish --force will overwrite if version number already exists in registry.

https://npmjs.org/doc/publish.html

2
votes

For others who land here and think they did it right. Yes, you did it right; Check your npm page in 5-10 minutes.

2
votes

The best thing you can do is:

Publish a new minor version:

npm publish [@<scope>/]<name>[@<your new minor version>]

Please see the discussion in detail here: http://blog.npmjs.org/post/77758351673/no-more-npm-publish-f


The following is discouraged(!) and should not be your first option

Be careful when doing this, after you unpublish a package it won't let you re-publish it until 24hs have passed.

You can unpublish the package leaving that version blank (but please understand the implications before you do this): npm unpublish [@<scope>/]<name>[@<version>]

Note: The --force argument is deprecated.