I have a Jenkins Pipeline job (Windows) where I run the following 'bat' command inside a steps block:
bat '''cd .\\ProductName\\src\\ProductName.UI
echo Start: npm install
npm install -f'''
Currently, there is a situation where this command fails, but the build step does not fail. So, seemingly, an error code is not returned to Jenkins.
To be clear, I am not asking for help to fix this particular error. I am asking for help to make the error notify Jenkins that the build step has failed.
To give a bit of context, here is an excerpt of the 'npm install' error:
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! node -v v10.3.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Build failed with error code: 1
So does npm install return an error code which can in turn be returned from the batch job? Or is there something else that I am missing?