commitizen / cz-cli

The commitizen command line utility. #BlackLivesMatter
http://commitizen.github.io/cz-cli/
MIT License
16.6k stars 552 forks source link

Cannot find module 'git-branch' #857

Open BartusZak opened 2 years ago

BartusZak commented 2 years ago

Hey,

I can not run commitizen.

Error:

yarn cz
yarn run v1.22.17
$ /home/bartuszak/gitlab/web-common/node_modules/.bin/cz
Cannot find module 'git-branch'
Require stack:
- /home/bartuszak/gitlab/web-common/commitizen.js
- /home/bartuszak/gitlab/web-common/node_modules/commitizen/dist/commitizen/adapter.js
- /home/bartuszak/gitlab/web-common/node_modules/commitizen/dist/commitizen.js
- /home/bartuszak/gitlab/web-common/node_modules/commitizen/dist/cli/git-cz.js
- /home/bartuszak/gitlab/web-common/node_modules/commitizen/bin/git-cz.js
- /home/bartuszak/gitlab/web-common/node_modules/commitizen/bin/git-cz
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

"commitizen": "4.2.1",

OS:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

Thanks for any hints.

costaevangelista commented 2 years ago

I had a similar problem when updating an old package and in my case the problem was that in my package.json I had the following config:

  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }

I was getting the issue even when I'd updated to ^3.0.2, and found I had to update the config to:

  "config": {
    "commitizen": {
      "path": "cz-conventional-changelog"
    }
  }

Ref: https://github.com/commitizen/cz-conventional-changelog/issues/89