gpt4 book ai didi

reactjs - 无法在 Jenkins 管道中构建 reactjs

转载 作者:行者123 更新时间:2023-12-04 19:06:25 26 4
gpt4 key购买 nike

它看起来很奇怪,因为我能够在本地(Ubuntu 20)中构建 ReactJS 应用程序,但是 jenkins 在同一台机器上运行抛出构建错误。另一个奇怪的是,当登录到 jenkins 用户时,我可以成功地构建它。花了 2 天时间,如果有人遇到同样的情况或有任何线索,现在在这里发布。
将 react 16 更改为 17,反之亦然。
---package.json---

    {
"name": "myeshopkart",
"version": "0.1.0",
"private": true,
"dependencies": {
"@capacitor/android": "^2.4.6",
"@capacitor/cli": "^2.4.6",
"@capacitor/core": "^2.4.6",
"@ckeditor/ckeditor5-build-classic": "^27.1.0",
"@ckeditor/ckeditor5-react": "^3.0.2",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/react-fontawesome": "^0.1.14",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.21.1",
"bootstrap": "^4.6.0",
"core-js": "^3.6.5",
"dotenv-cli": "^4.0.0",
"jquery": "^3.5.1",
"material-table": "^1.69.2",
"moment": "^2.29.1",
"node-sass": "^4.9.0",
"react": "^16.13.1",
"react-bootstrap": "^1.0.0",
"react-combine-reducers": "^1.0.3",
"react-data-table-component": "^6.11.7",
"react-datepicker": "^3.3.0",
"react-dialog": "^1.0.2",
"react-dom": "^16.13.1",
"react-error-boundary": "^3.1.1",
"react-hot-toast": "^2.0.0",
"react-moment": "^1.1.1",
"react-redux": "^7.2.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"redux": "^4.0.5",
"sass": "^1.32.5",
"styled-components": "^5.2.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test"

},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
---错误日志---
npm verb lifecycle myeshopkart@0.1.0~build: unsafe-perm in lifecycle true
npm verb lifecycle myeshopkart@0.1.0~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/lib/jenkins/workspace/a/eshopkart/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
npm verb lifecycle myeshopkart@0.1.0~build: CWD: /var/lib/jenkins/workspace/a/eshopkart
npm sill lifecycle myeshopkart@0.1.0~build: Args: [ '-c', 'react-scripts build' ]
npm sill lifecycle myeshopkart@0.1.0~build: Returned: code: 1 signal: null
npm info lifecycle myeshopkart@0.1.0~build: Failed to exec build script
npm verb stack Error: myeshopkart@0.1.0 build: `react-scripts build`
npm verb stack Exit status 1
npm verb stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
npm verb stack at EventEmitter.emit (events.js:375:28)
npm verb stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack at ChildProcess.emit (events.js:375:28)
npm verb stack at maybeClose (internal/child_process.js:1055:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm verb pkgid myeshopkart@0.1.0
npm verb cwd /var/lib/jenkins/workspace/a/eshopkart
npm verb Linux 5.4.0-73-generic
npm verb argv "/usr/bin/node" "/usr/bin/npm" "run" "build" "--loglevel" "silly"
npm verb node v14.17.1
npm verb npm v6.14.13
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myeshopkart@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myeshopkart@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 254305ms

npm ERR! A complete log of this run can be found in:
npm ERR! /var/lib/jenkins/.npm/_logs/2021-07-01T05_44_28_123Z-debug.log
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

最佳答案

我安装了新版本的 Jenkins ,默认情况下 WARN 消息被视为错误,因此无法构建。做 CI='' npm run build 工作。在旧版本中没有这样的问题。

关于reactjs - 无法在 Jenkins 管道中构建 reactjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68205100/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com