apm icon indicating copy to clipboard operation
apm copied to clipboard

Make error message better after deleting/recreating the repo behind a package

Open niklashigi opened this issue 8 years ago • 3 comments

Edit by @rsese

We found that the issue is if you publish a package but then delete and recreate the repository, if you then try to publish another version of your package you can get a confusing Creating new version failed: Git tag not found error.

You have to unpublish the package first and then publish to get around the error but it's not clear what the issue is from the error message.

x-ref: https://github.com/atom/apm/issues/707 and Jason's comment /cc https://github.com/atom/apm/issues/707#issuecomment-295773128 for more background.


Prerequisites

  • [x] Put an X between the brackets on this line if you have done all of the following [...]

Description

I'm currently working on a @semantic-release plugin for apm that has to publish a package based on an existing tag set by it. Whatever I try I don't seem to get it to work, apm publish --tag vX.Y.Z throws an error saying the tag doesn't exist although it clearly does.

Steps to Reproduce

  • Create an Atom package.
  • Login to APM with your token.
  • Follow what I did in this asciinema recording (note that I tried this multiple times and with longer delays).

Expected behavior:

The package gets successfully published.

Actual behavior:

Publishing [email protected] ✗
Creating new version failed: Git tag not found

Reproduces how often: 100%

Versions

Atom    : 1.22.1
Electron: 1.6.15
Chrome  : 56.0.2924.87
Node    : 7.4.0
apm  1.18.8
npm  3.10.10
node 6.9.5 x64
python 2.7.12
git 2.7.4

on Ubuntu 16.04.3 LTS

niklashigi avatar Nov 29 '17 21:11 niklashigi

Sorry for the trouble @shroudedcode - it looks like the issue is with https://github.com/shroudedcode/semantic-release-apm-example yes? Can you confirm if you published that package and then deleted/re-created the repository? I'm wondering if you're hitting the situation described in https://github.com/atom/apm/issues/707#issuecomment-295773128.

rsese avatar Dec 07 '17 23:12 rsese

Can you confirm if you published that package and then deleted/re-created the repository?

Yeah ... seems like I re-created the repository at some point while trying things out. Totally didn't think of that (because I wasn't aware of repository IDs).

I'm wondering if you're hitting the situation described in #707 (comment).

Looks very similar, I also tried the suggested fix (unpublish and publish again) and it worked.


While my issue is now solved, I think that you should add more telling error messages to prevent this from happening in the future, something like this:

The repository your package is linked to no longer exists. If you re-created the
repository at some point, try updating the repository link with "apm relink".

This way it's clear that nothing is wrong with the tag/tarball, but that the wrong repository is linked.

niklashigi avatar Dec 08 '17 18:12 niklashigi

I was desperately trying to publish a fork of markdown-preview-enhanced now and wasted more than an hour. Here's what I saw no matter what options etc. I tried:

apm publish minor
Preparing and tagging a new version ✓
Pushing v0.2.0 tag ✓
Publishing [email protected] ✗
Creating new version failed: Git tag not found
apm publish --tag v0.2.0
Publishing [email protected] ✗
Creating new version failed: Git tag not found

I did all possible sane and insane things such as unpublishing the package, adding or removing .git in package.json's repository field, manually pushing to master while the update was going, tweaking .git/config, and so on. But then I noticed that in my fork I had the tags from the original repo. So I was publishing v0.2.0 while there were tags like v0.3.0 ... v0.15.5 in the repo. Wiping out these tags on github either helped or just co-incised with a successful publish. Nevermind, going to sleep now 😫

kachkaev avatar Apr 14 '18 00:04 kachkaev