question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lerna hangs on publish

See original GitHub issue
$ npx lerna publish

...
lerna info execute Skipping git push
lerna info execute Skipping releases

And it hangs there. It creates CHANGELOG.md files and increments the version, but the command never finishes

Possible Solution

npx lerna publish from-package

In this case it finishes in seconds, except it does not increment versions or create changelog.

Steps to Reproduce (for bugs)

Repo: https://github.com/katawaredev/config

lerna.json

{
  "packages": ["packages/*"],
  "version": "independent",
  "command": {
    "publish": {
      "conventionalCommits": true,
      "message": "chore(release): release"
    },
    "bootstrap": { "hoist": true },
    "version": { "push": false }
  }
}

Context

The packages in the monorepo were not published before. Running npx lerna publish after npx lerna publish from-package again never finishes.

I am using Verdaccio to publish them locally for testing.

Your Environment

Executable Version
lerna --version 3.22.1
npm --version 6.14.4
node --version 10.19.0
OS Version
Pop!_OS 20.04

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:14

github_iconTop GitHub Comments

5reactions
romelperezcommented, Jan 16, 2021

I ran into the same issue with these settings:

Environment

  • os ubuntu v18.04
  • node v14.15.4
  • npm v6.14.10

package.json

{
  "name": "workspace",
  "version": "1.0.0",
  "private": true,
  "devDependencies": {
    "@commitlint/cli": "^11.0.0",
    "@commitlint/config-conventional": "^11.0.0",
    "commitizen": "^4.2.2",
    "cz-conventional-changelog": "^3.3.0",
    "husky": "^4.3.7",
    "lerna": "^3.22.1",
    "markdownlint": "^0.22.0",
    "markdownlint-cli": "^0.26.0",
    ...
  },
  "scripts": {
    "ci": "<run the test suite>",
    "release": "lerna publish",
    ...
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run ci",
      "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  }
}

lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "1.0.0-alpha.16",
  "command": {
    "publish": {
      "allowBranch": "main",
      "message": "chore(release): %s"
    }
  }
}

Workaround

I hit Ctrl + C just once and the process continues.

5reactions
arvigeuscommented, Jul 23, 2020

Thanks, @hoangnm, disabling Husky seemed to solve my issue: HUSKY_SKIP_HOOKS=1 lerna publish

The question is: Is this behavior a bug, or it is supposed to happen (e.g. it’s husky’s fault)? If it’s not related to lerna, I’ll close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Lerna hangs on publish - - Bountysource
Lerna hangs on publish · Possible Solution · Steps to Reproduce (for bugs) · Context · Your Environment.
Read more >
javascript - Lerna publish workflow not publishing as expected
For smoother CI experience, I have made a Github Action workflow to publish the monorepo packages with a prerelease version, everytime any ...
Read more >
Troubleshooting | Lerna
This can cause an issue where Lerna will ignore previously published releases which have been manually performed and tagged with the Github web...
Read more >
Managing monorepos with lerna and yarn workspaces - Medium
npx lerna publish --conventional-commits lerna notice cli v3.19.0 ... A few weeks of working on them will get you the hang of it....
Read more >
@lerna/publish | Yarn - Package Manager
@lerna/publish. owner lerna5.5mMIT6.0.3 vulns 0 vulnerabilities. Publish packages in the current project.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found