报错信息:
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! v3@0.1.0 build:test: `cross-env --REACT_APP_SKSXENV=test react-app-rewired build "CI=false"` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the v3@0.1.0 build:test script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/tomcat/.npm/_logs/2021-05-26T14_15_21_900Z-debug.log
而且,我们生产环境的jenkins使用npm构建vue前端product分支,虽然有warning级别的告警信息,却能正常构建完毕。
后仔细对比两个jenkin的构建记录,明显测试环境jenkins构建test分支的日志,明显多了下面的内容:
Creating an optimized production build... Treating warnings as errors because process.env.CI = true. Most CI servers set it automatically. Failed to compile.
最后谷歌搜索关键字process.env.CI,尝试解决办法——npm build前设置该参数值为false:
node -v yarn -v npm -v npm install export CI=false npm run build:test
问题解决,深入内容请自行查找!



