Question

Unable to deploy react app on the app platform

Posted March 24, 2021 1.5k views
Node.jsReactDigitalOcean App Platform

Whenever I try deploying my react app I get the following error and can’t workout why when it works fine on my pc. I saw somewhere else that increasing the amount of memory might fix it but this hasn’t worked for me.Any help would be appreciated.

void | 23:17:35 > test-app@0.1.0 build /workspace
void | 23:17:35 > react-scripts build
void | 23:17:35 
void | 23:17:38 Creating an optimized production build...
void | 23:20:36 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
void | 23:20:36 
void | 23:20:36 <--- Last few GCs --->
void | 23:20:36 
void | 23:20:36 [267:0x2d25e30]   179118 ms: Scavenge 1017.5 (1025.4) -> 1017.1 (1026.1) MB, 10.9 / 0.0 ms  (average mu = 0.167, current mu = 0.016) allocation failure 
void | 23:20:36 [267:0x2d25e30]   180099 ms: Mark-sweep 1018.0 (1026.1) -> 1016.7 (1025.4) MB, 976.8 / 0.0 ms  (average mu = 0.110, current mu = 0.057) allocation failure scavenge might not succeed
void | 23:20:36 [267:0x2d25e30]   180113 ms: Scavenge 1017.4 (1025.4) -> 1017.1 (1025.9) MB, 8.5 / 0.0 ms  (average mu = 0.110, current mu = 0.057) allocation failure 
void | 23:20:36 
void | 23:20:36 
void | 23:20:36 <--- JS stacktrace --->
void | 23:20:36 
void | 23:20:36 ==== JS stack trace =========================================
void | 23:20:36 
void | 23:20:36     0: ExitFrame [pc: 0x140a7f9]
void | 23:20:36     1: StubFrame [pc: 0x13adcd2]
void | 23:20:36 Security context: 0x2593c3d408d1 <JSObject>
void | 23:20:36     2: /* anonymous */(aka /* anonymous */) [0x25932badd1b1] [/workspace/node_modules/webpack-sources/lib/applySourceMap.js:~58] [pc=0x3cf6da4f9c26](this=0x097b6cf804b1 <undefined>,0x1905d9a41469 <String[2]: e=>,0x07111d4d6af1 <Object map = 0x1e6715da4ab9>)
void | 23:20:36     3: walk(aka SourceNode_walk) [0x2f74c460b239] [/workspace/node_modules...
void | 23:20:36 
void | 23:20:36  1: 0xa18150 node::Abort() [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  2: 0xa1855c node::OnFatalError(char const*, char const*) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  3: 0xb9705e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  4: 0xb973d9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  5: 0xd54655  [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  6: 0xd54ce6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  7: 0xd615a5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  8: 0xd62455 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36  9: 0xd64f0c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36 10: 0xd3343d v8::internal::Factory::NewRawTwoByteString(int, v8::internal::AllocationType) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36 11: 0xf73735 v8::internal::String::SlowFlatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::ConsString>, v8::internal::AllocationType) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36 12: 0xb962bb v8::internal::String::Flatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>, v8::internal::AllocationType) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36 13: 0xf4b6db v8::internal::StringTable::LookupString(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36 14: 0x1081853 v8::internal::JSReceiver::HasProperty(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::Name>) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36 15: 0x10863b8 v8::internal::Runtime_HasProperty(int, unsigned long*, v8::internal::Isolate*) [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:36 16: 0x140a7f9  [/layers/heroku_nodejs-engine/nodejs/bin/node]
void | 23:20:37 npm ERR! code ELIFECYCLE
void | 23:20:37 npm ERR! errno 1
void | 23:20:37 npm ERR! test-app@0.1.0 build: `react-scripts build`
void | 23:20:37 npm ERR! Exit status 1
void | 23:20:37 npm ERR! 
void | 23:20:37 npm ERR! Failed at the test-app@0.1.0 build script.
void | 23:20:37 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
void | 23:20:37 
void | 23:20:37 npm ERR! A complete log of this run can be found in:
void | 23:20:37 npm ERR!     /home/apps/.npm/_logs/2021-03-24T23_20_37_052Z-debug.log
void | 23:20:37 building: exit status 1
void | 23:20:37 ERROR: failed to build: exit status 1
void | 23:20:37  ! Build failed (145)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hey, @MaxBest are you deploying to DO or Heroku?
Your logs have heroku_nodejs-engine so just want to double-check this.

This error message says that your node process is out of memory.

If you could post a simple repository to help replicate your problem, it will be easier for the community to guide you in what can be done to fix your problem

  • @eugenehp thank you very much for your reply. I was trying to deploy it to DO’s App Platform.

    I managed to fix the issue by creating a new react app with npx create-react-app then adding in all the src and public files. Then one by one, using npm install to install all the dependencies.

    I am not too sure why this fixed it and why it wasn’t working before but I assume that it was an issue with the package or package-lock file that I wasn’t able to find just by reading through it.

    It was quite confusing as my initial thought was to increase the amount of memory after seeing the out-of-memory error but even after increasing from 1 to 8 GB I was still getting the same error so decided that wasn’t it.