Currently there are some breaking changes between Atom v1.12 and v1.13 (beta). I released a version that targets v1.13. Then I needed to release a patch version for a previous version of my package, the version that targets v1.12. However it does not seem possible. I thought it would be as simple as manually providing the tag on the command line.
This was discussed initially on the Atom forums, https://discuss.atom.io/t/can-not-publish-a-patch-for-an-older-version/36517/4 Below is a copy of my initial post from that page.
I'm trying to publish a patch version of an older version of a package. The latest version is for Atom 1.13 only, but I need to push out a fix for a version that is for Atom 1.12 only.
Here's what I did:
$ git co v0.25.2
$ git co -b feature/branch
# edited code
$ git add --all
$ git ci -m "blah blah"
$ git push -fu origin feature/branch
# on github, merged the branch into master
$ apm publish -t 0.25.3
Publishing [email protected] โ
Creating new version failed: Git tag not found
Uh.. OK? So I created the tag myself.
$ git tag v0.25.3
$ apm publish -t 0.25.3
Publishing [email protected] โ
Creating new version failed: Git tag not found
O... kay... I guess I need to push the tag to origin first?
$ git push origin v0.25.3
$ apm publish -t 0.25.3
Publishing [email protected] โ
Creating new version failed: Version exists
Um no. I literally just created the tag myself. The version does NOT exist yet.
Is there a way to force apm to publish this correctly?
Thanks for documenting this for us! I've brought it up to the dev team and we're going to see what we can do.
I think I ran into the same issue and managed to work around it.
Basically it seems that APM creates the tag vx.x.x but is looking for x.x.x.
Manually telling it to use vx.x.x works.
Edit: actually just realised mine is not for an older version, so this might not help in your case.
$ apm publish patch
Preparing and tagging a new version โ
Pushing v1.7.1 tag โ
Publishing [email protected] โ
Creating new version failed: Git tag not found
$ apm publish --tag 1.7.1
Publishing [email protected] โ
Creating new version failed: Git tag not found
$ apm publish --tag v1.7.1
Publishing [email protected] โ
@daaain Yes, this is specifically about publishing a version number that is smaller than the latest one published.
Ah, sorry then, didn't want to hijack!
Should I open a new issue then as it seems the problem is happening when doing a simple apm publish patch?
@daaain The problem that you're describing is something that is transitory and I'm running down with the back end people right now. No new Issue needed :grinning:
I have the same issue and it seems that I can not publish the first version I want to.
There are two issues:
How can I publish the version number as what I expected with apm?
@xufengli That isn't the same problem as this.
If you're having problems publishing your package and are looking for support, please check out either:
On Discuss and in the Atom Slack team, there are a bunch of helpful community members that should be willing to point you in the right direction.
@lexicalunit: Thanks for the detailed bug report. :zap::bow:
I think I've tracked down the root cause of the behavior you're seeing. I believe apm publish -t <tag> expects two important things to be true:
The Git tag already exists.
As you saw, you had to create the Git tag to resolve the "Git tag not found" error.
The package.json file at that tag contains the version number that you want to use when publishing.
This expectation :point_up: is the source of the final error that you ran into:
$ apm publish -t 0.25.3
Publishing [email protected] โ
Creating new version failed: Version exists
If we look at package.json at the v0.25.3 tag of lexicalunit/multi-wrap-guide, the version is specified as 0.25.2:

I think package authors have two ways to overcome this issue today.
Before creating the Git tag, edit package.json to have the desired version, and ensure that the specified version has not already been published. Using the steps from the issue body, this solution would function like so:
$ git co v0.25.2
$ git co -b feature/branch
# edit code
# change version in package.json to "0.25.3" <=================== NEW STEP
$ git add --all
$ git ci -m "blah blah"
$ git push -u origin feature/branch
# on github.com, merge the branch into master
$ git tag v0.25.3
$ git push origin v0.25.3
$ apm publish -t v0.25.3 <== SPECIFY THE TAG NAME. IT SHOULD BE THE VERSION NUMBER PREFIXED WITH "v".
On the branch that contains the patch, use apm publish patch to tag and publish the patch version.
$ git co v0.25.2
$ git co -b feature/branch
# edit code
$ git add --all
$ git ci -m "blah blah"
$ git push -u origin feature/branch
$ apm publish patch
Essentially, Option 1 is a more manual approach. It's expecting you to update the version in package.json and it's expecting you to create and push the Git tag.
Since Option 2 involves fewer steps, and since it uses the apm publish patch command that you'd use for patching the _current_ version of your package, I'd recommend using Option 2.
As an attempt to reduce confusion for anyone that runs into a similar issue in the future, we've enhanced the error detection and we've updated the error message to provide additional detail. Instead of this:
$ apm publish -t 0.25.3
Creating new version failed: Version exists
You'll now see this:
$ apm publish -t 0.25.3
Creating new version failed: You specified a tag with the version number '0.25.3', but the version number in package.json is '0.25.2'. The version numbers must agree before you can publish.
I hope that helps.
Is there a way to force apm to publish this correctly?
I think the explanation above answers this question, so I'm going to close this issue. If you still run into problems publishing a patch for an older version of your package, please let us know.
Thanks for the detail explanation and improved error message! ๐
Most helpful comment
@lexicalunit: Thanks for the detailed bug report. :zap::bow:
Findings
I think I've tracked down the root cause of the behavior you're seeing. I believe
apm publish -t <tag>expects two important things to be true:The Git tag already exists.
As you saw, you had to create the Git tag to resolve the "Git tag not found" error.
The
package.jsonfile at that tag contains the version number that you want to use when publishing.This expectation :point_up: is the source of the final error that you ran into:
$ apm publish -t 0.25.3
Publishing [email protected] โ
Creating new version failed: Version exists
If we look at
package.jsonat the v0.25.3 tag of lexicalunit/multi-wrap-guide, the version is specified as0.25.2:Currently-available solutions
I think package authors have two ways to overcome this issue today.
Option 1
Before creating the Git tag, edit
package.jsonto have the desired version, and ensure that the specified version has not already been published. Using the steps from the issue body, this solution would function like so:Option 2 (Recommended)
On the branch that contains the patch, use
apm publish patchto tag and publish the patch version.Essentially, Option 1 is a more manual approach. It's expecting you to update the version in
package.jsonand it's expecting you to create and push the Git tag.Since Option 2 involves fewer steps, and since it uses the
apm publish patchcommand that you'd use for patching the _current_ version of your package, I'd recommend using Option 2.Minimizing future confusion
As an attempt to reduce confusion for anyone that runs into a similar issue in the future, we've enhanced the error detection and we've updated the error message to provide additional detail. Instead of this:
You'll now see this:
I hope that helps.
I think the explanation above answers this question, so I'm going to close this issue. If you still run into problems publishing a patch for an older version of your package, please let us know.