纱线构建不工作,构建失败,因为进程退出太早
Posted
技术标签:
【中文标题】纱线构建不工作,构建失败,因为进程退出太早【英文标题】:Yarn Build not working, The build failed because the process exited too early 【发布时间】:2021-09-21 21:18:33 【问题描述】:尝试在 docker 节点内运行 yarn build。但是内存不足错误。
Error Image
节点 --version v14.7.0
纱线 --version 1.22.10
错误信息
构建失败,因为进程退出得太早。这大概 表示系统内存不足或有人调用
kill -9
过程。 error 命令失败,退出代码为 1。
Package.json
"name": "srf",
"version": "7.1.4",
"private": true,
"homepage": "/",
"scripts":
"start": "react-scripts start -o",
"build": "react-scripts --max_old_space_size=8192 build",
"test": "react-scripts test",
"citest": "CI=true react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint src",
"format": "prettier --write \"src/**/*.js,css,scss,html\"",
"rtl": "webpack"
,
"eslintConfig":
"extends": "react-app"
,
"browserslist":
"production": [
">0.2%",
"not dead",
"not op_mini all",
"ie 11"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
"last 1 edge version",
"IE 11"
]
,
"dependencies":
"@amcharts/amcharts4": "^4.10.16",
"@date-io/date-fns": "1.3.13",
"@formatjs/intl-pluralrules": "1.3.5",
"@fortawesome/fontawesome-free": "5.13.0",
"@manaflair/redux-batch": "1.0.0",
"@material-ui/core": "4.9.14",
"@material-ui/icons": "4.9.1",
"@material-ui/lab": "4.0.0-alpha.53",
"@material-ui/pickers": "3.2.10",
"@material-ui/styles": "4.9.14",
"@material/react-text-field": "^0.15.0",
"@reduxjs/toolkit": "1.3.6",
"@tanem/svg-injector": "8.0.50",
"apexcharts": "3.25.0",
"axios": "0.19.2",
"axios-mock-adapter": "1.18.1",
"bootstrap": "4.5.0",
"clipboard-copy": "3.1.0",
"clsx": "1.1.0",
"cp-cli": "2.0.0",
"css-mediaquery": "0.1.2",
"date-fns": "2.8.1",
"downshift": "3.4.2",
"fg-loadcss": "2.1.0",
"formik": "2.1.4",
"ga-4-react": "^0.1.271",
"jsencrypt": "^3.1.0",
"json2mq": "0.2.0",
"jss-rtl": "^0.3.0",
"lodash": "4.17.15",
"material-ui-popup-state": "1.4.1",
"moment": "^2.29.1",
"npm-lifecycle": "^3.1.5",
"object-path": "0.11.4",
"perfect-scrollbar": "1.5.0",
"prop-types": "15.7.2",
"react": "16.12.0",
"react-bootstrap": "1.0.1",
"react-bootstrap-table-next": "4.0.2",
"react-bootstrap-table2-paginator": "2.1.2",
"react-datepicker": "2.16.0",
"react-dom": "16.12.0",
"react-draggable": "4.4.2",
"react-dropdown-tree-select": "^2.5.1",
"react-ga": "^3.3.0",
"react-google-login": "^5.2.2",
"react-gtm-module": "^2.0.11",
"react-inlinesvg": "1.2.0",
"react-intl": "3.6.2",
"react-is": "16.13.1",
"react-moment": "^1.1.1",
"react-multiselect-checkboxes": "^0.1.1",
"react-perfect-scrollbar": "1.5.8",
"react-portal": "4.2.0",
"react-redux": "7.1.3",
"react-responsive-modal": "^6.0.1",
"react-router-dom": "5.1.2",
"react-router-redux": "^4.0.8",
"react-scripts": "4.0.2",
"react-select": "3.1.0",
"react-show-more-text": "^1.4.6",
"react-swipeable-views": "0.13.9",
"react-syntax-highlighter": "12.2.1",
"react-transition-group": "^4.4.2",
"react-window": "1.8.5",
"redux": "4.0.5",
"redux-persist": "6.0.0",
"redux-saga": "1.1.3",
"socicon": "3.0.5",
"websocket": "^1.0.33",
"yup": "0.29.0",
"yup-phone-lite": "^1.0.4"
,
"devDependencies":
"@babel/core": "^7.12.16",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.7.1",
"babel-jest": "^26.6.3",
"copyfiles": "2.1.1",
"jest": "^26.6.3",
"jest-dom": "^4.0.0",
"jest-watch-typeahead": "^0.6.1",
"nock": "^13.0.7",
"prettier": "1.19.1",
"sass": "1.34.1",
"serve": "11.2.0",
"webpack-cli": "3.3.11",
"webpack-messages": "2.0.4",
"webpack-rtl-plugin": "2.0.0"
【问题讨论】:
【参考方案1】:(MacOS 示例)
在 docker 桌面上分配更多内存或交换。那么构建就会成功。
例如,我将内存设置为 4GB,交换为 3GB。
【讨论】:
以上是关于纱线构建不工作,构建失败,因为进程退出太早的主要内容,如果未能解决你的问题,请参考以下文章
在 ReactJS 中构建纱线,分配失败 - JavaScript 堆内存不足
无法构建 xcode4.3,因为获取命令失败,退出代码为 1
MySQLdb Python 连接器构建和安装命令“gcc-4.2”失败,退出状态为 255