cz-cli icon indicating copy to clipboard operation
cz-cli copied to clipboard

postinstall script fails on CI

Open gabrieleantonini opened this issue 8 years ago β€’ 7 comments

On my CI server (Jenkins). postinstall script fails trying to execute: opencollective postinstall command.

This is the error

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've tried to add 'node_modules/opencollective/dist/bin' dir to the PATH but with no luck. Any ideas?

gabrieleantonini avatar Aug 31 '18 14:08 gabrieleantonini

Personally not a fan of the "postinstall": "opencollective ..." script for a number of reasons, mostly because it adds 11.6 MB of things to install just to print a message.

Maybe we could replace it with a simple echo statement? πŸ€”

LinusU avatar Sep 02 '18 21:09 LinusU

I’m ok with us removing it completely if it is annoying people.

Jim ForCy

On September 2, 2018 at 4:32:58 PM, Linus UnnebΓ€ck ([email protected]) wrote:

Personally not a fan of the "postinstall": "opencollective ..." script for a number of reasons, mostly because it adds 11.6 MB https://packagephobia.now.sh/result?p=opencollective of things to install just to print a message.

Maybe we could replace it with a simple echo statement? πŸ€”

β€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/commitizen/cz-cli/issues/560#issuecomment-417961338, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGpituOqhdXYpbEW3R5zkjTL_Yk0VCNks5uXE6KgaJpZM4WVWkF .

jimthedev avatar Sep 02 '18 22:09 jimthedev

I agree with @LinusU. Adding a package just for printing a (fancy) message doen't really add much value to the project. I'd πŸ‘ the idea of replacing opencollective package with a print message.

gabrieleantonini avatar Sep 03 '18 06:09 gabrieleantonini

As side note, I've figured out how to solve the initial problem on Jenkins. Basically, on my CI pipeline commitizen doesn't get installed globally so I have to manually specify the path to the opencollective bin. This can be achieved adding the following: :${env.WORKSPACE}/node_modules/.bin to the PATH configuration in Jenkinsfile file.

gabrieleantonini avatar Sep 03 '18 08:09 gabrieleantonini

Seems like this have been brought up before as well πŸ€” #544

At this point, it might be best to remove it for now?

It's still strange that you have to mess with the PATH though πŸ€” npm should fix that automatically when running scripts...

LinusU avatar Sep 03 '18 09:09 LinusU

@LinusU looking at the filesystem, under node_modules/.bin I can find a symlink opencollective -> ../opencollective/dist/bin/opencollective.js.

I suspect that in a "standard npm setup" node_modules/.bin is added to the path by default, on my CI box I believe there are some restrictions due to the fact that a docker container is created/destroyed for each build so I need to explicitely add node_modules/.bin to the path. It's just a guess as I don't have much control/knowledge over this CI pipeline.

gabrieleantonini avatar Sep 03 '18 09:09 gabrieleantonini

Thanks for removing the post-install hook! This was causing a lot of problems during CI.. if we can get a release with this fix that would be πŸ‘ πŸ™

phil-lgr avatar Sep 22 '18 15:09 phil-lgr