Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'load' of undefined #731

Closed
hristijankiko opened this issue May 5, 2020 · 14 comments
Closed

Cannot read property 'load' of undefined #731

hristijankiko opened this issue May 5, 2020 · 14 comments

Comments

@hristijankiko
Copy link

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.

@duartealexf
Copy link

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.

@Techn1x
Copy link

Techn1x commented May 5, 2020

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

@Techn1x
Copy link

Techn1x commented May 5, 2020

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.

@Techn1x
Copy link

Techn1x commented May 5, 2020

Looks like the configLoader.load() method was removed
6ef8afa#diff-a7267e0501a0781d4b4f795e54454767

But in 4.1.0 there is still a reference to it

let adapterConfig = environment.config || configLoader.load();

@hristijankiko
Copy link
Author

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

@Wentong-Liu
Copy link

same issue here

@xmlking
Copy link

xmlking commented May 5, 2020

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

@jimthedev
Copy link
Member

Seems like perhaps #729 modified the loader in some unexpected way @LinusU?

@jimthedev
Copy link
Member

For anyone having problems please downgrade to 4.0.5 for now.

@LinusU
Copy link
Contributor

LinusU commented May 5, 2020

🙈 sorry about this, investigating!

@LinusU
Copy link
Contributor

LinusU commented May 5, 2020

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!

@LinusU
Copy link
Contributor

LinusU commented May 5, 2020

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 🙈

@LinusU LinusU closed this as completed May 5, 2020
@fahimmahmoodmir
Copy link

fahimmahmoodmir commented May 5, 2020

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

@LinusU
Copy link
Contributor

LinusU commented May 5, 2020

@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: #734 (comment)

edit: released as 4.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants