Indira
Indira

Reputation: 21

Lerna publish fails says lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove the following changes before continuing

First things first, I am very much new to Lerna and it's the first time that I am asking a question here. I have been facing this error, when publishing the packages to our app registry. Publish error on GitHub Workflow

Error breakdown with log level silly Just to give a little background, Lerna is being used in our API repository and all this CI workflow has been working fine. But, suddenly it started giving the above error when Pull Request with certain changes in my branch are merged to the main branch. As part of the process, this PR branch got deleted automatically right after the changes are merged. Till this point Lerna's version was 4. Also, the file that Lerna says has to be committed, looks fine with all my changes in the main branch.

And, when I started to look for ways to get around this issue, I came across a few GitHub posts/issues that say that Network issues too might be a reason for improper commits and such publish issues. (I remember that my network was unstable) Then, I came across this post, https://github.com/lerna/lerna/issues/455 and upgraded Lerna to version 6.5.1.

Also, the github tags are first created at the Git repository, before the packages are published. I tried checking the latest published version on the registry using the command 'git describe --abbrev=0 --tags' which says version is 307, which was the last successful commit. After this, when I tried publishing my PR changes, it shows this error always but the next tags are committed in the repo. Also, npmrc file is under gitignore and I do not suspect that this might be changing during the workflow process.

Please let me know how to solve this issue as I do not have any clue in moving further and it's a show stopper. If you need any further information too, please let me know. Thank you so much.

Upvotes: 2

Views: 3720

Answers (1)

Pavel Bely
Pavel Bely

Reputation: 2415

Probably some file is changed during your Github Actions build.
That can happen if you run for instance eslint . --fix and it updates some file.

Use eslint option --fix only locally and avoid running with that option in CI to fix such issue.

Upvotes: 1

Related Questions