I can see that the build folder has been made but get this error message. I dont know wether I should worry or not. I does not happen when i do it on my local machine? yeah something def go wrong as I only get these 5 file made? How can i prevent this Command ran:
npm run build
icon.ico logo192.png logo512.png manifest.json robots.txt
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0xb09c10 node::Abort() [/usr/bin/node]
2: 0xa1c193 node::FatalError(char const*, char const*) [/usr/bin/node]
3: 0xcf8dbe v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
4: 0xcf9137 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
5: 0xeb09d5 [/usr/bin/node]
6: 0xec069d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
7: 0xec339e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
8: 0xe848da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
9: 0x11fd75c v8::internal::Runtime_AllocateInOldGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
10: 0x15f2099 [/usr/bin/node]
CodePudding user response:
Execute the same command but tell node to add more memory:
node --max-old-space-size=8192 <yourscript>
The problem is likely that this is set by environment variables, so your machine probably has a different value to the EC2.
Note that you would not be able to increase the allocated memory (8192MB in this example) more than the available memory of the machine. So if you are only running a .small
then you are inherently not going to be able to match your own powerful machine.