I'm trying to deploy an application on my eb instance. It is a t2.small so it has 2Gb memory. Still, when it comes to install dependencies, I'm getting an error because it is running out of ram :
2022/09/27 11:41:10.209208 [INFO] npm WARN config production Use `--omit=dev` instead.
<--- Last few GCs --->
[3318:0x55f9fa0] 74664 ms: Scavenge 971.9 (1014.0) -> 970.7 (1014.0) MB, 22.0 / 0.0 ms (average mu = 0.755, current mu = 0.702) allocation failure
[3318:0x55f9fa0] 74722 ms: Scavenge 972.7 (1014.0) -> 971.8 (1014.0) MB, 7.7 / 0.0 ms (average mu = 0.755, current mu = 0.702) allocation failure
[3318:0x55f9fa0] 74780 ms: Scavenge 974.4 (1014.0) -> 973.3 (1022.0) MB, 6.5 / 0.0 ms (average mu = 0.755, current mu = 0.702) allocation failure
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0xb02930 node::Abort() [npm install]
2: 0xa18149 node::FatalError(char const*, char const*) [npm install]
3: 0xcdd16e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [npm install]
4: 0xcdd4e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [npm install]
5: 0xe94b55 [npm install]
6: 0xea481d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [npm install]
7: 0xea751e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [npm install]
8: 0xe68a5a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [npm install]
9: 0x11e17c6 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [npm install]
10: 0x15d5439 [npm install]
2022/09/27 11:41:10.211702 [ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/sh -c npm --production install failed with error signal: aborted. Stderr:npm WARN config production Use `--omit=dev` instead.
<--- Last few GCs --->
[3318:0x55f9fa0] 74664 ms: Scavenge 971.9 (1014.0) -> 970.7 (1014.0) MB, 22.0 / 0.0 ms (average mu = 0.755, current mu = 0.702) allocation failure
[3318:0x55f9fa0] 74722 ms: Scavenge 972.7 (1014.0) -> 971.8 (1014.0) MB, 7.7 / 0.0 ms (average mu = 0.755, current mu = 0.702) allocation failure
[3318:0x55f9fa0] 74780 ms: Scavenge 974.4 (1014.0) -> 973.3 (1022.0) MB, 6.5 / 0.0 ms (average mu = 0.755, current mu = 0.702) allocation failure
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0xb02930 node::Abort() [npm install]
2: 0xa18149 node::FatalError(char const*, char const*) [npm install]
3: 0xcdd16e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [npm install]
4: 0xcdd4e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [npm install]
5: 0xe94b55 [npm install]
6: 0xea481d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [npm install]
7: 0xea751e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [npm install]
8: 0xe68a5a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [npm install]
9: 0x11e17c6 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [npm install]
10: 0x15d5439 [npm install]
I'm using node 16.17.0
and npm 8.15.0
.
List of dependencies :
"dependencies": {
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@material-ui/core": "^4.12.4",
"@material-ui/lab": "^4.0.0-alpha.61",
"@mui/icons-material": "^5.10.3",
"@mui/material": "^5.10.3",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.27.2",
"leaflet": "^1.6.0",
"leaflet-control-geocoder": "^2.2.0",
"leaflet.markercluster": "^1.5.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-html5-camera-photo": "^1.5.9",
"react-leaflet": "^3.2.0",
"react-leaflet-cluster": "^1.0.4",
"react-loader-spinner": "^4.0.0",
"react-redux": "^8.0.2",
"react-scripts": "^5.0.1",
"react-toastify": "^9.0.8",
"redux": "^4.2.0",
"styled-components": "^5.2.1",
"styled-media-query": "^2.1.2",
"styled-reset": "^4.3.4",
"web-vitals": "^1.1.1"
}
I've tried to add 1Gb swap on my instance it didn't change anything.