以下是在Ubuntu Linux主机上使用root
用户从命令提示符运行时的npm run build
:
从输出中可以看到,尽管有建议,但命令成功运行,这从echo $?
的输出中可以看出
但是,当我以root用户身份使用Jenkins“execute shell”运行相同的命令时,它失败了,如以下输出所示:
cd /etc/jenkins_tmp/workspace/SGGS_QA_UI;
npm run build
if [ $? -eq 0 ]; then
echo "npm build was successful. Copying ...";
else
echo " npm install failed. Check Jenkins console out";
fi
输出:
Line 151:8: React Hook useEffect has missing dependencies: 'callSetLoggedIn', 'navigate', and 'setCurrentPage'. Either include them or remove the dependency array react-hooks/exhaustive-deps
src/pages/resetpassword/Resetpassword.jsx
Line 1:29: 'useEffect' is defined but never used no-unused-vars
Line 14:8: 'ResendOtp' is defined but never used no-unused-vars
Build step 'Execute shell' marked build as a failure
Finished: FAILURE
我已经检查了Jenkins的资源、服务器健康状况和磁盘空间,以及执行npm run build
的目标服务器,一切看起来都很好。
您能否建议我如何识别和修复此问题,以便Jenkins能够成功执行npm run build
?
1条答案
按热度按时间5fjcxozz1#
变更为
CI=false npm run build
以解决该问题,因为它将警告消息视为错误消息。我仍然不知道为什么它没有失败时,通过命令行运行没有Jenkins。