+ whoami
root
+ npm run build
> web@0.1.1 build /var/lib/jenkins/workspace/web
> react-app-rewired build
Creating an optimized production build...
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
chunk 6 [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ScreenMember/index.less
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ScreenProject/index.less
- couldn't fulfill desired order of chunk group(s)
- while fulfilling desired order of chunk group(s) , ,
chunk 6 [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ChoiceMember/index.less
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ScreenProject/index.less
- couldn't fulfill desired order of chunk group(s)
- while fulfilling desired order of chunk group(s) , ,
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! curvature-platform-web@0.1.1 build: `react-app-rewired build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the web@0.1.1 build 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! /root/.npm/_logs/2021-11-28T15_42_06_584Z-debug.log
Build step 'Execute shell' marked build as failure
Finished: FAILURE
特别诡异,我jenkins里whoami 是root;
但是我通过ssh登录root用户到这个目录,运行build命令就成功了。
Creating an optimized production build...
Compiled with warnings.
chunk 6 [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ScreenMember/index.less
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ScreenProject/index.less
- couldn't fulfill desired order of chunk group(s)
- while fulfilling desired order of chunk group(s) , ,
chunk 6 [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ChoiceMember/index.less
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/components/ScreenProject/index.less
- couldn't fulfill desired order of chunk group(s)
- while fulfilling desired order of chunk group(s) , ,
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
File sizes after gzip:
1.07 MB build/static/js/16.0b28738f.chunk.js
276.92 KB build/static/js/0.aeb2730e.chunk.js
239.15 KB build/static/js/main.8807acc6.chunk.js
232.37 KB build/static/js/17.0577e11c.chunk.js
The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://goo.gl/9VhYWB
You can also analyze the project dependencies: https://goo.gl/LeUzfb
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
bit.ly/CRA-deploy
help!
这个有哪些可能导致这个原因?
求大佬帮助
你的命令在
jenkins
配置里是怎么写?就是whoami
和npm run build
,有可能是jenkins
执行的会话和最终在服务器的会话不是同一个导致的。可以试试这样写,放在进去服务器后的同一个会话里。