• notice
  • Congratulations on the launch of the Sought Tech site

Solution after lerna's failed release!

As a management solution for multiple package dependencies, lerna has indeed solved a lot of pain points. I have used lerna a lot in my work and life, but I also encounter some problems at the same time. The problem after the release fails is encountered more frequently problem, so record

lerna publishMainly do the following things:

  • Check if there is a commit since the previous git tag, if there is no commit, No changed packages to publishthe message will be displayed, and then exit

  • Check packages that depend on modified packages and update dependency information

  • Submit the corresponding version ofgit tag

  • Publish modified packages and packages that depend on them

It looks very ideal, but it may be very painful to use. Often the problem may be the last step, the problem of publishing the package, there may be a problem with your network situation, it may be that you have not logged in to npm (including the company's internal registry), If you need to publish to a registryspecific , you can lerna.jsonspecify on :

"command": {
   "publish": {
     "message": "chore(release): publish",
     "registry": "http://legos.wq.jd.com/legosv5/registry/"

I've encountered this problem several times, as follows:
127-rqonz4tg1lr (1).png

Regarding this issue, the community also has corresponding discussions, which can be found in the issue of the lernaproject , such as 524, 1894

In this regard, lerna has not provided a good solution so far.

You can use the from-gitparameter , i.e.lerna publish from-git

Or we can manually roll back git to the version before release and delete the corresponding ones git tag, as follows:

git reset --hard HEAD~1 && git tag -d $(git log --date-order --tags --simplify-by-decoration --pretty=format:'%d' | head -1 | tr -d '()' | sed 's/,* tag://g')


Technical otaku

Sought technology together

Related Topic


Leave a Reply