Not able to build a react application in droplets

npm -v 7.6.0

node -v v16.15.1

Droplet configuration: 2 GB Memory / 1 Intel vCPU / 50 GB Disk + 100 GB / SGP1 - Ubuntu 20.04 (LTS) x64

Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-107-generic x86_64)

System information as of Tue Jun 28 14:17:02 UTC 2022

System load: 0.04 Usage of /: 6.9% of 48.29GB Memory usage: 19% Swap usage: 0% Processes: 125 Users logged in: 1

(Latest npm and node versions throws “git dep preparation failed”)

1vcpu-2gb-intel-sgp1-01:~/frontend# npm run build

client@0.1.0 build /root/frontend react-scripts build

Creating an optimized production build…

<— Last few GCs —>

[26903:0x514ab80] 107420 ms: Mark-sweep (reduce) 989.0 (1011.7) -> 988.2 (1013.9) MB, 2038.4 / 0.0 ms (+ 277.3 ms in 44 steps since start of marking, biggest step 22.8 ms, walltime since start of marking 2382 ms) (average mu = 0.106, current mu = 0.028[26903:0x514ab80] 109906 ms: Mark-sweep (reduce) 989.2 (1001.9) -> 988.2 (1001.9) MB, 2475.4 / 0.0 ms (average mu = 0.056, current mu = 0.004) allocation failure scavenge might not succeed

<— JS stacktrace —>

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0xa3aaf0 node::Abort() [node] 2: 0x970199 node::FatalError(char const*, char const*) [node] 3: 0xbba42e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0xbba7a7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0xd769c5 [node] 6: 0xd7754f [node] 7: 0xd8538b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 8: 0xd88f4c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node] 9: 0xd4e71d v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node] 10: 0xd4a979 v8::internal::FactoryBasev8::internal::Factory::AllocateRawArray(int, v8::internal::AllocationType) [node] 11: 0xd4aa34 v8::internal::FactoryBasev8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Handlev8::internal::Map, int, v8::internal::Handlev8::internal::Oddball, v8::internal::AllocationType) [node] 12: 0xf920be v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Allocate(v8::internal::Isolate*, int, v8::internal::AllocationType) [node] 13: 0xf92256 v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Rehash(v8::internal::Isolate*, v8::internal::Handlev8::internal::OrderedHashMap, int) [node] 14: 0x1083a58 v8::internal::Runtime_MapGrow(int, unsigned long*, v8::internal::Isolate*) [node] 15: 0x1448df9 [node] npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! client@0.1.0 build: react-scripts build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the client@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-06-28T14_13_01_634Z-debug.log

Adding “build”: “react-scripts --max_old_space_size=4096 build” in package.json also not helped

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer