Stephan Bijzitter
Stephan Bijzitter

Reputation: 4595

Revert version of unpublished Node.js package

I have a package which I released on NPM and it's currently at version 1.0.1.

I have made some changes locally, and wanted to publish them. I entered npm version 1.0.3 and then felt stupid, because I wanted to type npm version 1.0.2.

How can I restore this mistake?

Upvotes: 28

Views: 17417

Answers (1)

Stephan Bijzitter
Stephan Bijzitter

Reputation: 4595

A colleague just suggested to reset my repository to the remote repository and try again, it worked.

I first used the following commands to reset my repository's master branch (as if it's a clean clone):

git fetch origin
git reset --hard origin/master

Also delete the tags from local and remote git tag -d 1.0.2 Remove from local repo git push --delete origin 1.0.2 remove from remote repo

Then I simply added the version:

npm version 1.0.2

Upvotes: 53

Related Questions