Open jimthedev opened 7 years ago
I just ran into this problem and it seems that adding the --force
flag worked for me, but I did already have a package.json
.
Enter the directory of the project, and run npm init --yes
to generate package.json
, then execute commitizen init cz-conventional-changelog --save --save-exact
.
It works for me.
Any update on above issue?
Installing commitizen globally using the steps in the documentation as shown here
Prevents you from being able to run
commitizen init --save-dev cz-conventional-changelog
in a brand new npm project.Actually running
commitizen init --save-exact --save-dev cz-conventional-changelog --force
results in:I think this is because when running init we need to assume that the user wants to only init in the current directory, as such we should not be using findup to get the highest npm path like we do when looking for an adapter. Instead we need to be stricter in the case of init. We should explicitly be looking in the current directory for a package.json or we should fail.