Interview Prep/Jenkins/Jenkinsfile syntax, Groovy & CPS errors

`hudson.AbortException: script returned exit code 127`

BeginnerTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer

Likely causes → Command not found in the container or agent where sh ran: running in jnlp instead of the tool container, wrong image, missing PATH.

Diagnose →

sh 'echo $PATH; which node || true; cat /etc/os-release'

Check whether the step is inside container('node') or a defaultContainer is set.

Fix → Wrap with container('node') { }, set defaultContainer, or use an image that has the tool.

Prevent → Standard pod templates per stack in the shared library.

All Jenkins questions Roadmap: Jenkins

More on Jenkinsfile syntax, Groovy & CPS errors