我有一个项目使用 commitizen 没有问题。我决定添加 husky 来运行precommit
更漂亮的钩子。问题是当我运行npm run cm
命令时,我得到这个错误......
.....................
? Are there any breaking changes? No
? Does this change affect any open issues? No
nvm is not compatible with the "npm_config_prefix" environment variable: currently set to "/Users/aiglesias/.nvm/versions/node/v8.9.4"
Run `unset npm_config_prefix` to unset it.
.git/hooks/pre-commit: line 49: node: command not found
husky > npm run -s precommit (node )
env: node: No such file or directory
husky > pre-commit hook failed (add --no-verify to bypass)
/Users/aiglesias/Coding/react/react-basesupsub/node_modules/commitizen/dist/cli/strategies/git-cz.js:102
throw error;
^
Error: git exited with error code 1
at ChildProcess.<anonymous> (/Users/aiglesias/Coding/react/react-basesupsub/node_modules/commitizen/dist/git/commit.js:50:26)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-basesupsub@0.0.0-development cm: `git-cz`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-basesupsub@0.0.0-development cm script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/aiglesias/.npm/_logs/2018-02-03T08_22_42_663Z-debug.log
我已经删除了 prettier 并尝试了 husky 和一个基本的npm run test
precommit 钩子,但出现了同样的错误。显然,我看到了消息,但我不知道跑步是否unset npm_config_prefix
会在其他地方给我带来更大的问题。
编辑:
- 在我的环境中既没有
$NPM_CONFIG_PREFIX
也没有设置。$PREFIX
- 我试过
unset npm_config_prefix
了,但结果相同。