gabric
gabric

Reputation: 1975

npm install PATH for postinstall scripts on Jenkins

My JS project uses a NPM package called commitizen: https://github.com/commitizen/cz-cli

commitizen is added to my devDependencies in package.json file. commitizen uses internally a package called opencollective as you can see here: https://github.com/commitizen/cz-cli/blob/master/package.json

commitizen on postinstall hook is calling opencollective postinstall which is supposed to run opencollective package binary.

Locally I've no problems running the postinstall hook, however, when I build my project on my Jenkins CI box I get this error when it runs the postinstall hook of commitizen package

sh: 1: opencollective: not found

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 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! [email protected] postinstall: `opencollective postinstall`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I tried to add node_modules/opencollective/dist/bin dir to the PATH but with no luck, I think because the opencollective alias is defined in opencollective package.json

Any idea about how to be able to run opencollective command without installing globally opencollective package?

Thank you!

Upvotes: 1

Views: 2050

Answers (0)

Related Questions