Bitbucket 管道失败,不允许我创建 React 构建

发布于 2025-01-10 04:08:41 字数 7100 浏览 0 评论 0原文

从今天早上开始,我在使用 Bitbucket Pipelines 构建 React 应用程序的过程中遇到了错误。我的应用程序以前没有任何变化,相同的构建正在运行,但从今天开始它开始显示问题。

当我尝试在本地构建我的应用程序时,我没有收到任何错误。

Build setup
6s
CI=false
<1s
cd React/WebApp
<1s
npm install
1m 57s
CI=false npm run build
6m 20s
+ CI=false npm run build
> [email protected] build /opt/atlassian/pipelines/agent/build/React/WebApp
> react-scripts build
Creating an optimized production build...
Failed to compile.
src/App.jsx
  Line 50:5:  Missing "key" prop for element in array  react/jsx-key
src/common/card_information/card_information.jsx
  Line 23:7:    Missing "key" prop for element in array  react/jsx-key
  Line 23:7:    Missing "key" prop for element in array  react/jsx-key
  Line 23:7:    Missing "key" prop for element in array  react/jsx-key
  Line 27:7:    Missing "key" prop for element in array  react/jsx-key
  Line 27:7:    Missing "key" prop for element in array  react/jsx-key
  Line 27:7:    Missing "key" prop for element in array  react/jsx-key
  Line 28:9:    Missing "key" prop for element in array  react/jsx-key
  Line 28:9:    Missing "key" prop for element in array  react/jsx-key
  Line 31:13:   Missing "key" prop for element in array  react/jsx-key
  Line 36:9:    Missing "key" prop for element in array  react/jsx-key
  Line 36:9:    Missing "key" prop for element in array  react/jsx-key
  Line 38:7:    Missing "key" prop for element in array  react/jsx-key
  Line 38:7:    Missing "key" prop for element in array  react/jsx-key
  Line 38:7:    Missing "key" prop for element in array  react/jsx-key
  Line 60:17:   Missing "key" prop for element in array  react/jsx-key
  Line 60:17:   Missing "key" prop for element in array  react/jsx-key
  Line 61:19:   Missing "key" prop for element in array  react/jsx-key
  Line 63:17:   Missing "key" prop for element in array  react/jsx-key
  Line 63:17:   Missing "key" prop for element in array  react/jsx-key
  Line 64:19:   Missing "key" prop for element in array  react/jsx-key
  Line 76:17:   Missing "key" prop for element in array  react/jsx-key
  Line 76:17:   Missing "key" prop for element in array  react/jsx-key
  Line 77:19:   Missing "key" prop for element in array  react/jsx-key
  Line 79:17:   Missing "key" prop for element in array  react/jsx-key
  Line 79:17:   Missing "key" prop for element in array  react/jsx-key
  Line 80:19:   Missing "key" prop for element in array  react/jsx-key
  Line 89:11:   Missing "key" prop for element in array  react/jsx-key
  Line 113:13:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 115:17:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 118:17:  Missing "key" prop for element in array  react/jsx-key
  Line 118:17:  Missing "key" prop for element in array  react/jsx-key
  Line 119:17:  Missing "key" prop for element in array  react/jsx-key
  Line 119:17:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 135:23:  Missing "key" prop for element in array  react/jsx-key
  Line 135:23:  Missing "key" prop for element in array  react/jsx-key
  Line 136:25:  Missing "key" prop for element in array  react/jsx-key
  Line 138:23:  Missing "key" prop for element in array  react/jsx-key
  Line 138:23:  Missing "key" prop for element in array  react/jsx-key
  Line 139:25:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 149:23:  Missing "key" prop for element in array  react/jsx-key
  Line 149:23:  Missing "key" prop for element in array  react/jsx-key
  Line 150:25:  Missing "key" prop for element in array  react/jsx-key
  Line 152:23:  Missing "key" prop for element in array  react/jsx-key
  Line 152:23:  Missing "key" prop for element in array  react/jsx-key
  Line 153:25:  Missing "key" prop for element in array  react/jsx-key
  Line 161:19:  Missing "key" prop for element in array  react/jsx-key
  Line 185:7:   Missing "key" prop for element in array  react/jsx-key
  Line 188:13:  Missing "key" prop for element in array  react/jsx-key
  Line 195:11:  Missing "key" prop for element in array  react/jsx-key
  Line 197:9:   Missing "key" prop for element in array  react/jsx-key
  Line 197:9:   Missing "key" prop for element in array  react/jsx-key
  Line 198:11:  Missing "key" prop for element in array  react/jsx-key
  Line 201:9:   Missing "key" prop for element in array  react/jsx-key
  Line 201:9:   Missing "key" prop for element in array  react/jsx-key
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/2022-02-25T13_22_41_074Z-debug.log
2022-02-25T13:22:41.098641374Z stdout P   Line 26:7:  

我可以在所有 jsx 上添加密钥,但昨天它使用相同的代码,但现在它告诉我在所有 jsx 上添加密钥道具,这是不可能的,因为应用程序有超过 100 个模块(我已从错误中删除了错误行以保持问题简短)。即使它提到的所有 jsx 元素并非都是数组元素。

since this morning I'm encountering an error in the build process of my React application using Bitbucket Pipelines. Nothing has changed to my application previosuly the same build was working but from today it is started showing the issue.

When I try to build my app locally I don't get any errors.

Build setup
6s
CI=false
<1s
cd React/WebApp
<1s
npm install
1m 57s
CI=false npm run build
6m 20s
+ CI=false npm run build
> [email protected] build /opt/atlassian/pipelines/agent/build/React/WebApp
> react-scripts build
Creating an optimized production build...
Failed to compile.
src/App.jsx
  Line 50:5:  Missing "key" prop for element in array  react/jsx-key
src/common/card_information/card_information.jsx
  Line 23:7:    Missing "key" prop for element in array  react/jsx-key
  Line 23:7:    Missing "key" prop for element in array  react/jsx-key
  Line 23:7:    Missing "key" prop for element in array  react/jsx-key
  Line 27:7:    Missing "key" prop for element in array  react/jsx-key
  Line 27:7:    Missing "key" prop for element in array  react/jsx-key
  Line 27:7:    Missing "key" prop for element in array  react/jsx-key
  Line 28:9:    Missing "key" prop for element in array  react/jsx-key
  Line 28:9:    Missing "key" prop for element in array  react/jsx-key
  Line 31:13:   Missing "key" prop for element in array  react/jsx-key
  Line 36:9:    Missing "key" prop for element in array  react/jsx-key
  Line 36:9:    Missing "key" prop for element in array  react/jsx-key
  Line 38:7:    Missing "key" prop for element in array  react/jsx-key
  Line 38:7:    Missing "key" prop for element in array  react/jsx-key
  Line 38:7:    Missing "key" prop for element in array  react/jsx-key
  Line 60:17:   Missing "key" prop for element in array  react/jsx-key
  Line 60:17:   Missing "key" prop for element in array  react/jsx-key
  Line 61:19:   Missing "key" prop for element in array  react/jsx-key
  Line 63:17:   Missing "key" prop for element in array  react/jsx-key
  Line 63:17:   Missing "key" prop for element in array  react/jsx-key
  Line 64:19:   Missing "key" prop for element in array  react/jsx-key
  Line 76:17:   Missing "key" prop for element in array  react/jsx-key
  Line 76:17:   Missing "key" prop for element in array  react/jsx-key
  Line 77:19:   Missing "key" prop for element in array  react/jsx-key
  Line 79:17:   Missing "key" prop for element in array  react/jsx-key
  Line 79:17:   Missing "key" prop for element in array  react/jsx-key
  Line 80:19:   Missing "key" prop for element in array  react/jsx-key
  Line 89:11:   Missing "key" prop for element in array  react/jsx-key
  Line 113:13:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 114:15:  Missing "key" prop for element in array  react/jsx-key
  Line 115:17:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 117:15:  Missing "key" prop for element in array  react/jsx-key
  Line 118:17:  Missing "key" prop for element in array  react/jsx-key
  Line 118:17:  Missing "key" prop for element in array  react/jsx-key
  Line 119:17:  Missing "key" prop for element in array  react/jsx-key
  Line 119:17:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 121:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 131:15:  Missing "key" prop for element in array  react/jsx-key
  Line 135:23:  Missing "key" prop for element in array  react/jsx-key
  Line 135:23:  Missing "key" prop for element in array  react/jsx-key
  Line 136:25:  Missing "key" prop for element in array  react/jsx-key
  Line 138:23:  Missing "key" prop for element in array  react/jsx-key
  Line 138:23:  Missing "key" prop for element in array  react/jsx-key
  Line 139:25:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 145:15:  Missing "key" prop for element in array  react/jsx-key
  Line 149:23:  Missing "key" prop for element in array  react/jsx-key
  Line 149:23:  Missing "key" prop for element in array  react/jsx-key
  Line 150:25:  Missing "key" prop for element in array  react/jsx-key
  Line 152:23:  Missing "key" prop for element in array  react/jsx-key
  Line 152:23:  Missing "key" prop for element in array  react/jsx-key
  Line 153:25:  Missing "key" prop for element in array  react/jsx-key
  Line 161:19:  Missing "key" prop for element in array  react/jsx-key
  Line 185:7:   Missing "key" prop for element in array  react/jsx-key
  Line 188:13:  Missing "key" prop for element in array  react/jsx-key
  Line 195:11:  Missing "key" prop for element in array  react/jsx-key
  Line 197:9:   Missing "key" prop for element in array  react/jsx-key
  Line 197:9:   Missing "key" prop for element in array  react/jsx-key
  Line 198:11:  Missing "key" prop for element in array  react/jsx-key
  Line 201:9:   Missing "key" prop for element in array  react/jsx-key
  Line 201:9:   Missing "key" prop for element in array  react/jsx-key
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/2022-02-25T13_22_41_074Z-debug.log
2022-02-25T13:22:41.098641374Z stdout P   Line 26:7:  

I can add key on all the jsx but yesterday it was working with same code but now it is telling to add key props on all the jsx which is not possible because application has over 100 modules(I have removed error lines from error to keep the question short). even not all the jsx element it is mentioning is an array element.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朮生 2025-01-17 04:08:41

我得到了一个解决方案,将其

 "react/jsx-key": 0,

添加到项目的 .eslintrc.json 管道中将开始工作

I got a solution for this

 "react/jsx-key": 0,

add this in project's .eslintrc.json pipeline will start working

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文