1

我的 JS 项目使用一个名为commitizenhttps ://github.com/commitizen/cz-cli 的 NPM 包

commitizen被添加到我devDependencies的 package.json 文件中。 commitizen在内部使用一个名为的包opencollective,如您在此处看到的:https ://github.com/commitizen/cz-cli/blob/master/package.json

commitizen在 postinstall 钩子上调用opencollective postinstall它应该运行opencollective包二进制文件。

在本地我运行 postinstall 钩子没有问题,但是,当我在我的 Jenkins CI 盒子上构建我的项目时,当它运行commitizen包的 postinstall 钩子时出现此错误

sh: 1: opencollective: not found

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! commitizen@2.10.1 postinstall: `opencollective postinstall`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the commitizen@2.10.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我试图将node_modules/opencollective/dist/bindir 添加到 PATH 但没有运气,我认为是因为opencollective别名是在opencollectivepackage.json中定义的

关于如何在不安装全局opencollective包的情况下运行 opencollective 命令的任何想法?

谢谢!

4

0 回答 0