我有一个Jenkins Pipeline作业(Windows),我在步骤块中运行以下“ bat”命令:
bat '''cd .\\ProductName\\src\\ProductName.UI
echo Start: npm install
npm install -f'''
当前,此命令可能会失败,但构建步骤不会失败。因此,貌似不会将错误代码返回给Jenkins。
为清楚起见,我并不是在寻求帮助来修复此特定错误。我正在寻求帮助,以使错误通知Jenkins构建步骤已失败。
为了提供一些背景信息,下面是“ npm install”错误的摘录:
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
那么npm install是否返回错误代码,该错误代码又可以从批处理作业中返回?还是还有其他我想念的东西?