Cz-cli: Cannot read property 'load' of undefined

Created on 5 May 2020  路  14Comments  路  Source: commitizen/cz-cli

I attempted to install and set up commitizen to my project for the first time, but it seems like it is throwing a strange error.

> npx git-cz

Cannot read property 'load' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1

This is a fresh install and no custom configuration. This is what is in my package.json config

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

I had a look through the code and I suspect this is the line where the error is thrown
image

If anyone has any idea why it would be throwing this error please let me know.

Most helpful comment

This PR should fix it: #733

Will merge as soon as it is green. Super sorry for this everyone, I didn't realise that this was part of the public api.

Will also have a look at why the tests didn't catch this, it seems like they do now that a new version is published. I believe that this is because the tests install from npm, a good approach is probably to change this to npm pack and then npm install /path/to/pack/file.gz instead.

Hopefully a new version should be published in ~15 minutes!

All 14 comments

I also just ran into this and have no idea why this is happening... I've never seen it before.
I downgraded to 3.1.2 (with cz-conventional-changelog @ 2.1.0) and it's working fine.

Having the same problem here. Upgraded to 4.1.0 and started seeing the error. Rolling back to ~4.0.5 seems to work.

To help searchability this is the error I get on 4.1.0

yarn git-cz        
yarn run v1.22.0
$ ./node_modules/.bin/git-cz
Cannot read property 'load' of undefined
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Looks like the configLoader.load() method was removed
https://github.com/commitizen/cz-cli/commit/6ef8afa7600da429a473290a917003177a2ec00a#diff-a7267e0501a0781d4b4f795e54454767

But in 4.1.0 there is still a reference to it
https://github.com/commitizen/cz-cli/blob/f7982d38c0882e7e91a011bfd409e2262858bfb1/src/cli/git-cz.js#L17

@Techn1x I'm pretty sure its not the method that's undefined, its the configLoader itself.

same issue here

recently I am having various issues with commitizen I cannot commit my code anymore with git cz

Seems like perhaps https://github.com/commitizen/cz-cli/pull/729 modified the loader in some unexpected way @LinusU?

For anyone having problems please downgrade to 4.0.5 for now.

馃檲 sorry about this, investigating!

This PR should fix it: #733

Will merge as soon as it is green. Super sorry for this everyone, I didn't realise that this was part of the public api.

Will also have a look at why the tests didn't catch this, it seems like they do now that a new version is published. I believe that this is because the tests install from npm, a good approach is probably to change this to npm pack and then npm install /path/to/pack/file.gz instead.

Hopefully a new version should be published in ~15 minutes!

This should be fixed in version 4.1.1, super sorry for the breakage!

Also sorry for the slow response, shouldn't release and then go to bed I guess 馃檲

now I have an issue with a different error after updating to 4.1.1:
The "path" argument must be of type string. Received type undefined

image

@fahimmahmoodmir sorry about that, it's being fixed in #735 which is currently being released.

I've written up here on why I didn't catch this when developing this, and how I will avoid releasing broken builds in the future here: https://github.com/commitizen/cz-cli/issues/734#issuecomment-624017625

edit: released as 4.1.2

Was this page helpful?
0 / 5 - 0 ratings