Cz-cli: The "path" argument must be of type string. Received type undefined

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

Issue description

Hi,

I am having a problem in running the package with the latest fix release of 4.1.1. I receive The "path" argument must be of type string. Received type undefined error whenever I try to run the package. I am using yarn as a package manager

Steps to reproduce the issue

  1. Run yarn git-cz

What's the expected result?

  • To run the command successfully

What's the actual result?

  • Error with The "path" argument must be of type string. Received type undefined (Image below)

image

Most helpful comment

Really sorry about this, I definitively need to work on some things in order for this not to happen again:

1) Setting up so that I always test the final version locally myself
2) Improving the tests so that they catch this
3) Understanding and documenting which code is part of the public api, and which aren't

I have a fix up at #735 which I'll merge as soon as the CI is green, which should be in a few minutes.

Again, sorry for the trouble this is causing!


A small follow up on why I didn't catch this when testing locally:

cz-conventional-changelog has a dependency on commitizen, so when I ran npm pack in my working copy of commitizen and then installed that in my test repo (npm install /path/to/pack.tar.gz) npm still kept _another_ copy of commitizen installed in node_modules/cz-conventional-changelog/node_modules/commitizen. Since that copy was pulled from npm it wasn't using my local changes.

The simple fix for this is to rm -r node_modules/cz-conventional-changelog/node_modules/commitizen which will make cz-conventional-changelog use the version of commitizen that I installed from npm pack. Unfortunately I didn't notice this until now.

I really want to set up a test bench so that this can be done automatically. I know how to test it properly now, but it's very easy to miss, and it will be hard for new contributors to know.

I hope that this gives some understanding to how the broken build made it's way out, and what we are doing to fix this in the future.


So to recap, this is how to properly test it locally right now:

  1. Pack your local version \
    npm pack
  2. Create an empty repo \
    mkdir foo; cd foo; git init; echo {} > package.json
  3. Install you packed version of commitizen: \
    npm install /path/to/pack.tgz
  4. Run the init command \
    ./node_modules/.bin/commitizen init cz-conventional-changelog --save-dev --save-exact
  5. Remove the extra commitizen \
    rm -r node_modules/cz-conventional-changelog/node_modules/commitizen
  6. Test a commit \
    ./node_modules/.bin/git-cz

All 4 comments

same here.. can you guys please at least try for yourself and see if it's working before releasing a new version..

it caused by changing default value of configLoader.load on 6ef8afa.
related to #729

Really sorry about this, I definitively need to work on some things in order for this not to happen again:

1) Setting up so that I always test the final version locally myself
2) Improving the tests so that they catch this
3) Understanding and documenting which code is part of the public api, and which aren't

I have a fix up at #735 which I'll merge as soon as the CI is green, which should be in a few minutes.

Again, sorry for the trouble this is causing!


A small follow up on why I didn't catch this when testing locally:

cz-conventional-changelog has a dependency on commitizen, so when I ran npm pack in my working copy of commitizen and then installed that in my test repo (npm install /path/to/pack.tar.gz) npm still kept _another_ copy of commitizen installed in node_modules/cz-conventional-changelog/node_modules/commitizen. Since that copy was pulled from npm it wasn't using my local changes.

The simple fix for this is to rm -r node_modules/cz-conventional-changelog/node_modules/commitizen which will make cz-conventional-changelog use the version of commitizen that I installed from npm pack. Unfortunately I didn't notice this until now.

I really want to set up a test bench so that this can be done automatically. I know how to test it properly now, but it's very easy to miss, and it will be hard for new contributors to know.

I hope that this gives some understanding to how the broken build made it's way out, and what we are doing to fix this in the future.


So to recap, this is how to properly test it locally right now:

  1. Pack your local version \
    npm pack
  2. Create an empty repo \
    mkdir foo; cd foo; git init; echo {} > package.json
  3. Install you packed version of commitizen: \
    npm install /path/to/pack.tgz
  4. Run the init command \
    ./node_modules/.bin/commitizen init cz-conventional-changelog --save-dev --save-exact
  5. Remove the extra commitizen \
    rm -r node_modules/cz-conventional-changelog/node_modules/commitizen
  6. Test a commit \
    ./node_modules/.bin/git-cz

Released the fix as 4.1.2, I have also tested this version from npm and it works for me

Please let me know if there are any more troubles, and sorry for the broken builds!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rbutera picture rbutera  路  6Comments

jacobq picture jacobq  路  7Comments

fendy-g picture fendy-g  路  7Comments

gaurav5430 picture gaurav5430  路  7Comments

martinhbramwell picture martinhbramwell  路  4Comments