2

I've got a deploy process set up in jenkins, which first installs the entire JavaScript app locally on the jenkins server, starts grunt for testing/building the app, and copies everything over to a staging machine afterwards.

Yesterday I noticed that I had a typo in my package.json and npm failed to install an updated module, thus throwing a warning.

Jenkins seems to have noticed that issue and marked the build as UNSTABLE, but kept on deploying (Post-Build tasks using ssh-copy plugin).

Is there a way to stop a build process when NPM fails to install a module?

1 Answer 1

5

you can try

npm install || exit 1

What this command says is if the "npm install" command didn't run successfully (didn't return exit code of 0) then "exit 1"

For reference: How to exit if a command failed?

Sign up to request clarification or add additional context in comments.

1 Comment

Please provide further details about how this could solve the problem of the user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.