报错场景
jenkins使用npm构建vue前端报错,手动构建正常
报错内如
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
src/api/api.js
Line 2:8: 'React' is defined but never used no-unused-vars
src/api/attestation/index.js
Line 2:8: 'qs' is defined but never used no-unused-vars
src/api/query/index.js
Line 2:8: 'qs' is defined but never used no-unused-vars
...
解决方法
# 添加变量
export CI=false
npm install
参考文档
https://stackoverflow.com/questions/62663451/treating-warnings-as-errors-because-process-env-ci-true-failed-to-compile