98

I created a NPM module and I published it at version 0.0.1

I made some changes and pushed those to github, and I would like it so that when one uses npm install myModule the new version is used.

How do I tell NPM that there is a version 0.0.2?

davnicwil
  • 28,487
  • 16
  • 107
  • 123
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
  • 1
    possible duplicate of [Do I need to publish to npm every time I update a package available via git?](http://stackoverflow.com/questions/13507763/do-i-need-to-publish-to-npm-every-time-i-update-a-package-available-via-git) – nwinkler Apr 15 '15 at 12:24

5 Answers5

136

Change the version in your package.json or use npm version <new-version>.

After changing the version number in your package.json, you can run npm publish to publish the new version to NPM.

npm install will install the latest version in the NPM repository.

aalaap
  • 4,145
  • 5
  • 52
  • 59
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
34

Increase the version number and then run npm publish yourModule again - as described in the npm docs.

npm install yourModule will then install the latest version from the NPM registry.

I found the last answer a little misleading, sorry.

aug
  • 11,138
  • 9
  • 72
  • 93
eljefedelrodeodeljefe
  • 6,304
  • 7
  • 29
  • 61
10

For me, updating the version in the package.json still resulted in the "You cannot publish over..." error.

The steps to resolve were (based on ops version number):

  1. npm version 0.0.2

  2. npm publish

pim
  • 12,019
  • 6
  • 66
  • 69
9
  1. If it is an patch release (small changes) use following:

     npm version patch
    

    It will increment the last part of version number.

  2. If it is a minor release (new features) use following:

     npm version minor
    

    It will increment the middle part of version number.

  3. If it is a major release (major features or major issue fixes) use following:

     npm version major
    

    It will increment the first part of version number.

Yuvraj Patil
  • 7,944
  • 5
  • 56
  • 56
6

From the npmjs documentation:

  1. To change the version number in package.json, on the command line, in the package root directory, run the following command, replacing <update_type> with one of the semantic versioning release types (patch, major, or minor):

    npm version <update_type>

  2. Run npm publish.
  3. Go to your package page (https://npmjs.com/package/) to check that the package version has been updated.
Chris Hein
  • 61
  • 1
  • 4