Skip to content

Error running lerna updated #16

Closed
Closed

Description

@doctyper

Hi, I'm trying to run lerna on an existing monorepo. I've run lerna bootstrap without issues, but I'm seeing this error when running lerna updated:

Checking packages...
fatal: No annotated tags can describe 'af2c265fda2e7a93c4f6881b747e6f398d4e7c8d'.
However, there were unannotated tags: try --tags.
child_process.js:484
    throw err;
    ^

Error: Command failed: git describe af2c265fda2e7a93c4f6881b747e6f398d4e7c8d
fatal: No annotated tags can describe 'af2c265fda2e7a93c4f6881b747e6f398d4e7c8d'.
However, there were unannotated tags: try --tags.

    at checkExecSyncError (child_process.js:441:13)
    at Object.execSync (child_process.js:481:13)
    at execSync (/usr/local/lib/node_modules/lerna/lib/commands/updated.js:63:16)
    at Object.exports.checkUpdatedPackages (/usr/local/lib/node_modules/lerna/lib/commands/updated.js:30:23)
    at Object.exports.execute (/usr/local/lib/node_modules/lerna/lib/commands/updated.js:9:33)
    at Object.<anonymous> (/usr/local/lib/node_modules/lerna/bin/lerna.js:41:9)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)

Any idea what could be wrong?

Activity

  1. hzoo commented on Jan 20, 2016

    @hzoo
    Contributor

    Not sure, I extracted out what lerna publish was doing.

    It looks like it is erroring on line 30. git describe sha-number

    After reading stack overflow, it looks like git describe only uses annotated tags by default and I guess none of the tags in the repo are annotated.

    It looks like we could potentially do git describe --tags and it would work. @kittens?

    Yeah that's probably it since we do that above that

      var lastTagCommit = execSync("git rev-list --tags --max-count=1");
      var lastTag       = execSync("git describe " + lastTagCommit);
  2. added 2 commits that reference this issue on Jan 20, 2016
    c3fa74e
    558d091
  3. danielo515 commented on Jun 29, 2017

    @danielo515
    Contributor

    Is this considered to be fixed ? I'm facing the exact same issue on 2.0.0-rc.5

  4. nevir commented on Jul 8, 2017

    @nevir

    Ditto on 2.0.0

  5. danielo515 commented on Sep 1, 2017

    @danielo515
    Contributor

    Well, here I am again, facing this problem at 2.0.0

  6. evocateur commented on Sep 1, 2017

    @evocateur
    Member

    v2.0.0+ uses (and creates) annotated git tags. I'm fairly certain it was changed in one of the release candidates. https://stackoverflow.com/questions/5002555/can-a-lightweight-tag-be-converted-to-an-annotated-tag#5002886 describes how to migrate your last lightweight tag, which should then fix lerna updated for you.

  7. danielo515 commented on Sep 1, 2017

    @danielo515
    Contributor

    Thanks @evocateur,
    I'll check that link. For me it is failing on publish with --skip-npm on a brand new repo

  8. danielo515 commented on Sep 1, 2017

    @danielo515
    Contributor

    I just checked the provided link, and it's something I already did. My repo one has two tags, the oldest one which is non annotated and another one which is annotated. Lerna update does not fail, but it does the publish

  9. danielo515 commented on Sep 12, 2017

    @danielo515
    Contributor

    This is still happening randmoly.
    I have several annotated tags created by lerna (using lerna publish). I have added a couple of commits and run lerna publish and now it fails again with the same error. This never happened to me before, I can't understand what is wrong.

    Any help will be appreciated
    Regards

  10. danielo515 commented on Sep 12, 2017

    @danielo515
    Contributor

    Ok, here I am again with a bit more of information.
    Seems that having the current branch unpublished to the remote makes this error to trigger. I don't see why this happens at all, but it happens. Maybe it's because lerna makes the assumption that I want to publish changes to the remote repository, and it does not check if that is possible beforehand to provide an useful error message.

    I have published the branch and now it works, but sadly lerna now says that there is no package to update, which is not true. How can I say to lerna what is the correct tag to compare with ?

  11. danielo515 commented on Sep 12, 2017

    @danielo515
    Contributor

    Here I am wit some (I hope) more useful information.

    I just made a small change to a file (the version on the package.json) and now lerna detects the changes correctly and proposes the proper updates (I'm using conventional-changelog).

    So in summary

    • If you are in a non-published branch, lerna will fail on publish or checking updated with the "no tag can describe " error
    • If you publish that branch later (after all the work is done ) lerna will not detect any change
    • If you made any change from that point, everything works fine again.

    Hope that summary helps lerna developers to improve the tool or any other person facing this problem

    Regards

  12. danielo515 commented on Sep 20, 2017

    @danielo515
    Contributor

    In my opinion this issue should be reopened. The bug exists and it's well documented and it is also very annoying.
    Even if you don't want to bug the root cause of the problem it would be ideal to provide any fallback mechanism. Maybe allowing to create a manual named tag using lerna or whatever we came up with

  13. danielo515 commented on Sep 20, 2017

    @danielo515
    Contributor

    Also I want to note that all my tags are annotated:

    So I'm a bit on a dead end here: all my tags are annotated, but I can not create a new tag because the current sha is not an annotated tag.
    I don't know what lerna actually expects and why this fails randomly

  14. 1 remaining item

  15. askz commented on Feb 9, 2018

    @askz

    Other solution is to merge tag with
    git merge <tag>

  16. rufman commented on Jul 6, 2018

    @rufman

    This seems broken again. publish does not create an annotated tag, but updated only looks for annotated tags.

  17. evocateur commented on Jul 6, 2018

    @evocateur
    Member

    @rufman I can assert with 100% confidence that lerna publish does create annotated tags. It has been over a year since that functionality was released.

  18. rufman commented on Jul 6, 2018

    @rufman

    @evocateur when I ran lerna publish and then lerna updated the tag that was being referenced was not the tag that was just created, but an earlier one (an annotated tag from before the repo used lerna).

    Checking out the code it seems that there is no -a option in the tag command here: https://github.com/lerna/lerna/blob/master/commands/publish/lib/git-tag.js#L11

  19. evocateur commented on Jul 6, 2018

    @evocateur
    Member
  20. btakita commented on Aug 2, 2018

    @btakita

    I'm trying lerna for the first time. I'm running into the same error.

    I'm really confused over how lerna is supposed to work. Sorry if this is not helpful, but it would be great to understand what's going on.

    ¯\_(ツ)_/¯

  21. btakita commented on Aug 2, 2018

    @btakita

    Could this be the culprit?

    https://github.com/lerna/lerna/blob/master/utils/collect-updates/collect-updates.js#L30

    I changed the line to and it seems to work:

    committish = childProcess.execSync("git", ["describe", "--tags", "--abbrev=0"], execOpts);
  22. evocateur commented on Aug 3, 2018

    @evocateur
    Member

    Could this be the culprit? ...

    @btakita No, --tags is only necessary when you need to also match "lightweight" tags, which is not what lerna publish creates, I can assure you.

  23. btakita commented on Aug 3, 2018

    @btakita

    I tried it again (without --tags) & the error is gone after publishing the packages (with --tags). Publish seems good as well. Not sure why it's working or why it didn't work before.

    ISTR that there was a tag created by oao, but I'm not sure if that caused the problem.

    Maybe the tag created by oao was in a format that lerna did not expect (e.g. v2.0.4)

  24. evocateur commented on Aug 3, 2018

    @evocateur
    Member

    It probably wasn't annotated, which explains why git describe missed it. Lightweight tags are not appropriate to use for release tags, as documented:

    Tag objects (created with -a, -s, or -u) are called "annotated" tags; they contain a creation date, the tagger name and e-mail, a tagging message, and an optional GnuPG signature. Whereas a "lightweight" tag is simply a name for an object (usually a commit object).

    Annotated tags are meant for release while lightweight tags are meant for private or temporary object labels. For this reason, some git commands for naming objects (like git describe) will ignore lightweight tags by default.

  25. geekplux commented on Sep 7, 2018

    @geekplux

    same error here. using lerna in an existing project.

  26. evocateur commented on Sep 8, 2018

    @evocateur
    Member

    @geekplux If you can provide more details and a consistent reproduction of your error, please open a new issue. Thanks!

  27. lock commented on Dec 27, 2018

    @lock

    This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  28. locked as resolved and limited conversation to collaborators on Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions