lerna: Lerna hangs on publish
$ 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 |
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 8
- Comments: 15
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.
I ran into the same issue with these settings:
Environment
package.json
lerna.json
Workaround
I hit
Ctrl + C
just once and the process continues.I got the same problem, then I found out it’s the
prepare-commit-msg
hook that prevents lerna to finish the git commit action.@mderrien29 this is my “prepare-commit-msg” hook, it works for me
I’m not an expert on shell script. If you are using POSIX sh instead of bash, the script may need to be changed. Anyway the point is to check $2 and skip commitizen if it’s “message”.
I see this as well and found a strange work around… just do CTRL+C (or whatever your terminal quit command is) just once, and the process resumes.
Hey folks, I’ve been fighting with this this the whole morning and finally I found a solution.
Seems that using the latest Husky version ( “husky”: “^6.0.0” ), if you want to skip hooks you need to use:
Instead of:
https://typicode.github.io/husky/#/?id=with-env-variables
I’m also using cross-env to avoid isues with windows machines https://www.npmjs.com/package/cross-env
This is my npm script where I skip husky-precommit (commitizen), lerna generates the changelogs for all packages and everything works:
This is the prepare-commit-msg husky hook:
And this is the result:
Before this fix, I was receiving this error due I was not skipping Husky:
Hope it helps!