facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.69k stars 26.84k forks source link

Cannot build the app with FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #5484

Closed huyhoangtb closed 5 years ago

huyhoangtb commented 6 years ago

I trying to build a very big app and get the error. <--- Last few GCs --->

[26469:0x38298e0] 2286026 ms: Mark-sweep 1308.6 (1451.1) -> 1308.6 (1451.1) MB, 3088.9 / 0.0 ms allocation failure GC in old space requested [26469:0x38298e0] 2288588 ms: Mark-sweep 1308.6 (1451.1) -> 1308.6 (1450.1) MB, 2561.1 / 0.0 ms last resort GC in old space requested [26469:0x38298e0] 2291185 ms: Mark-sweep 1308.6 (1450.1) -> 1308.6 (1450.1) MB, 2596.8 / 0.0 ms last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x20f3d95a5501 1: / anonymous /(aka / anonymous /) [0x79ae55822d1 :~3193] [p c=0xc8277fdc9c1](this=0x79ae55822d1 ,self=0x3cd52c617b89 ,tw=0x2f8d4fb082d1 ) 2: before [0x79ae55822d1 :~5479] [pc=0xc8277c50773](this=0x2f8d4f b082d1 ,node=0x3cd52c617b89 <AST_Call map = 0x3 4a4f5...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memo ry 1: node::Abort() [node] 2: 0x11f155c [node] 3: v8::Utils::ReportOOMFailure(char const, bool) [node] 4: v8::internal::V8::FatalProcessOutOfMemory(char const, bool) [node] 5: v8::internal::Factory::NewCode(v8::internal::CodeDesc const&, unsigned int, v8::internal::Handle, bool, int) [node] 6: v8::internal::CodeGenerator::MakeCodeEpilogue(v8::internal::TurboAssembler, v8::internal::EhFrameWriter, v8::internal::CompilationInfo, v8::internal::Han dle) [node] 7: v8::internal::compiler::CodeGenerator::FinalizeCode() [node] 8: v8::internal::compiler::PipelineImpl::FinalizeCode() [node] 9: v8::internal::compiler::PipelineCompilationJob::FinalizeJobImpl() [node] 10: v8::internal::Compiler::FinalizeCompilationJob(v8::internal::CompilationJob ) [node] 11: v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions() [node ] 12: v8::internal::StackGuard::HandleInterrupts() [node] 13: v8::internal::Runtime_StackGuard(int, v8::internal::Object*, v8::internal:: Isolate) [node] 14: 0xc82769842fd npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! admin-web-app@0.1.0 build: node build-production.js && npm run build-c ss && react-app-rewired build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the admin-web-app@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-10-19T08_30_00_758Z-debug.log

The package.json:

{ "name": "admin-web-app", "version": "0.1.0", "private": true, "dependencies": { "antd": "^3.10.0", "axios": "^0.16.2", "d3": "^4.13.0", "dotenv": "^4.0.0", "font-awesome": "^4.7.0", "font-awesome-webpack": "0.0.5-beta.2", "fs": "0.0.1-security", "history": "^4.7.2", "lodash.clone": "^4.5.0", "lodash.debounce": "^4.0.8", "lodash.get": "^4.4.2", "lodash.isequal": "^4.5.0", "lodash.isequalwith": "^4.4.0", "lodash.remove": "^4.7.0", "lodash.shuffle": "^4.2.0", "lodash.trim": "^4.5.1", "material-icons": "^0.1.0", "material-ui": "^0.20.0", "material-ui-chip-input": "^0.18.7", "moment": "^2.22.2", "normalizr": "^3.2.4", "prop-types": "^15.6.1", "query-string": "^5.1.1", "quilljs": "^0.18.1", "react": "^16.3.2", "react-addons-css-transition-group": "^15.6.2", "react-audio-player": "^0.5.0", "react-avatar-editor": "^9.1.1", "react-big-calendar": "^0.17.0", "react-click-outside": "^2.3.1", "react-color": "^2.14.1", "react-custom-scrollbars": "^4.2.1", "react-d3-radar": "^0.2.6", "react-dom": "^16.3.2", "react-draggable": "^3.0.5", "react-dropzone": "^3.13.4", "react-facebook-login": "^3.7.2", "react-flip-move": "^3.0.2", "react-google-login": "^2.11.3", "react-grid-layout": "^0.16.6", "react-helmet": "^5.2.0", "react-loadable": "^5.4.0", "react-measure": "^2.0.2", "react-pdf-js": "^1.0.37", "react-player": "^0.17.2", "react-quill": "^1.2.7", "react-redux": "^5.0.7", "react-router": "^4.2.0", "react-router-config": "^1.0.0-beta.4", "react-router-dom": "^4.2.2", "react-router-redux": "^5.0.0-alpha.9", "react-scrollable-anchor": "^0.5.0", "react-selectable": "^2.0.1", "react-share": "^1.19.1", "react-slick": "^0.14.11", "react-sortable-hoc": "tungang/react-sortable-hoc", "react-sortable-tree": "^0.1.21", "react-stars": "^2.2.5", "react-swipeable-views": "^0.12.13", "react-to-print": "^1.0.14", "react-virtualized": "^9.18.5", "recharts": "^1.2.0", "redux": "^3.7.2", "redux-form": "^6.8.0", "redux-form-material-ui": "^4.3.4", "redux-persist": "^5.9.1", "redux-saga": "^0.14.8", "reselect": "^3.0.1", "riek": "^1.1.0", "screenfull": "^3.3.2", "slick-carousel": "^1.8.1", "socket.io-client": "^2.1.0", "sprintf-js": "^1.1.1", "styled-components": "^3.2.6", "uuid": "^3.3.2" }, "devDependencies": { "babel-cli": "^6.26.0", "babel-eslint": "^7.2.3", "babel-jest": "^19.0.0", "babel-plugin-import": "^1.8.0", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-2": "^6.24.1", "enzyme": "^3.3.0", "enzyme-adapter-react-16": "^1.1.1", "eslint": "^3.19.0", "eslint-config-airbnb": "^14.1.0", "eslint-plugin-babel": "^4.1.2", "eslint-plugin-flowtype": "^2.46.2", "eslint-plugin-import": "^2.11.0", "eslint-plugin-jsx-a11y": "^4.0.0", "eslint-plugin-mocha": "^4.12.1", "eslint-plugin-react": "^6.10.3", "eslint-plugin-redux-saga": "^0.3.0", "file-loader": "^0.11.2", "husky": "^1.0.0-rc.15", "jest-localstorage-mock": "^2.2.0", "json-schema-filter": "^0.1.5", "lint-staged": "^7.3.0", "node-sass-chokidar": "0.0.3", "npm-run-all": "^4.1.2", "prettier": "^1.14.3", "react-addons-test-utils": "^15.6.2", "react-app-rewire-less": "^2.1.1", "react-app-rewire-uglifyjs": "^0.1.1", "react-app-rewire-vendor-splitting": "^1.3.0", "react-app-rewired": "^1.5.2", "react-cosmos": "^3.6.1", "react-cosmos-redux-proxy": "^3.6.1", "react-cosmos-wrapper-proxy": "^1.1.1", "react-scripts": "^1.1.4", "react-test-renderer": "^16.3.2", "redux-devtools-extension": "^2.13.2", "regenerator-runtime": "^0.10.5", "scriptjs": "^2.5.8", "webpack-bundle-analyzer": "^3.0.2" }, "lint-staged": { "src/*/.{js,jsx,json,css}": [ "prettier --single-quote --write", "git add" ] }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, "scripts": { "build-css": "node-sass-chokidar src/ -o src/", "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive --usePolling --polling-interval 500", "start-js": "react-scripts start", "wstart": "npm-run-all -p watch-css start-js", "start": "NODE_PATH=./src npm-run-all -p watch-css start-js", "build": "node build-production.js && npm run build-css && react-app-rewired build", "build-old": "node build-production.js && npm run build-css && react-scripts build", "test": "NODE_PATH=./src jest --setupTestFrameworkScriptFile=raf/polyfill", "wtest": "jest", "eject": "react-scripts eject", "cosmos": "NODE_PATH=./src cosmos", "cosmos:export": "NODE_PATH=./src cosmos-export" }, "jest": { "setupFiles": [ "jest-localstorage-mock" ] } }

bugzpodder commented 6 years ago

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration Can you turn off GENERATE_SOURCEMAP?

Also see https://github.com/facebook/create-react-app/issues/4536#issuecomment-393647911

huyhoangtb commented 5 years ago

@bugzpodder: I turn off GENERATE_SOURCEMAP before and it work fine (very slow when i build the project) but for now, it can work. May be the source code have bean growing up and it happen again.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

Timer commented 5 years ago

The only way to fix this is to increase Node's heap size or add some bundle splitting to your app.

Good luck!