commitizen / cz-conventional-changelog

A commitizen adapter for the angular preset of https://github.com/conventional-changelog/conventional-changelog
MIT License
769 stars 440 forks source link

cz.prompt(...).then is not a function #20

Open bmayen opened 8 years ago

bmayen commented 8 years ago

Getting the following error on cz-conventional-changelog@1.1.6:

node_modules/cz-conventional-changelog/index.js:79
    ]).then(function(answers) {
       ^

TypeError: cz.prompt(...).then is not a function
    at module.exports.prompter (node_modules/cz-conventional-changelog/index.js:79:8)
    at commit (.nvm/versions/node/v5.10.1/lib/node_modules/commitizen/dist/commitizen/commit.js:68:5)
    at .nvm/versions/node/v5.10.1/lib/node_modules/commitizen/dist/cli/strategies/git-cz.js:89:30
    at .nvm/versions/node/v5.10.1/lib/node_modules/commitizen/dist/commitizen/staging.js:30:5
    at .nvm/versions/node/v5.10.1/lib/node_modules/commitizen/node_modules/gulp-git/lib/exec.js:27:5
    at ChildProcess.exithandler (child_process.js:193:7)
    at emitTwo (events.js:100:13)
    at ChildProcess.emit (events.js:185:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)

v1.1.5 appears to work as expected.

aklinkert commented 8 years ago

This is because of an older global version of commitizen. A npm update -g commitizen does help and solve the issue.

In this case the wire between the global module and the locally installed one should either be tightened or removed.

jimthedev commented 8 years ago

@apinnecke is correct. This is 100% my fault although hopefully I can provide a bit of background:

Inquirer.js went to 1.0.0 after being in 0.0 for a long time. I missed the breaking changes that were included. Typically my understanding is that when going from 0.0 to 1.0 you won't have any breaking changes from the last few 0.0 releases since you're indicating that your product is finally stable. This was a BAD assumption on my part. As it turns out there was very much a breaking change. Now that Inquirer is at 1.0.0, future breaking change releases (meaning going to 2.. or 3.. will be easier to spot). Nevertheless my apologies for introducing this issue.

At this point the solution is to make sure you're on 2.8.1 of the commitizen cli or higher and the latest version of this adapter (1.1.6 or higher) and you should be ok.

sarbbottam commented 8 years ago

Could you try updating the path to cz-conventional-changelog instead of node_modules/cz-conventional-changelog?

ThisIsMissEm commented 4 years ago

@jimthedev this could be fixed with specify a peerDependency of commitizen @ >= 2.8.1, meaning that everyone will get told to update if they're not up-to-date