Baremetal deploy issues

I’m having issues with deployment of my app well using BareMetal i have tested the app build on the server using

yarn rw build

but every time i deploy it fails on the web build.

✖ Error while running command `yarn rw build web` in /var/www/moonfolio/20240815200000
  ✖ Building Web... [FAILED: Command failed with exit code 134: node /var/www/moonfolio/20240815200000/node_modules/@redwoodjs/vite/bins/rw-vite-build.mjs
  --webDir="/var/www/moonfolio/20240815200000/web" --verbose=false

  <--- Last few GCs --->

  [17906:0x64025b0]    35041 ms: Scavenge 963.8 (995.0) -> 961.5 (996.0) MB, 5.07 / 0.00 ms  (average mu = 0.354, current mu = 0.139) allocation failure;
  [17906:0x64025b0]    35060 ms: Scavenge 964.3 (996.0) -> 962.4 (996.5) MB, 5.76 / 0.00 ms  (average mu = 0.354, current mu = 0.139) allocation failure;
  [17906:0x64025b0]    35082 ms: Scavenge 965.7 (996.7) -> 963.7 (1005.7) MB, 7.83 / 0.00 ms  (average mu = 0.354, current mu = 0.139) allocation failure;


  <--- JS stacktrace --->

  FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
  ----- Native stack trace -----

  1: 0xb82d33 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/bin/node]
  2: 0xef0c50 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/bin/node]
  3: 0xef0f37 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/bin/node]
  4: 0x1102ad5  [/usr/bin/node]
  5: 0x111a958 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
  6: 0x10f0a71 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]      
  7: 0x10f1c05 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]     
  8: 0x10cf256 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
  9: 0x152b086 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
  10: 0x1964ef6  [/usr/bin/node]
  Aborted (core dumped)]
  Error: Command failed with exit code 134: node /var/www/moonfolio/20240815200000/node_modules/@redwoodjs/vite/bins/rw-vite-build.mjs --webDir="/var/www/moonfolio/20240815200000/web" --verbose=false  

  <--- Last few GCs --->

  [17906:0x64025b0]    35041 ms: Scavenge 963.8 (995.0) -> 961.5 (996.0) MB, 5.07 / 0.00 ms  (average mu = 0.354, current mu = 0.139) allocation failure;
  [17906:0x64025b0]    35060 ms: Scavenge 964.3 (996.0) -> 962.4 (996.5) MB, 5.76 / 0.00 ms  (average mu = 0.354, current mu = 0.139) allocation failure;
  [17906:0x64025b0]    35082 ms: Scavenge 965.7 (996.7) -> 963.7 (1005.7) MB, 7.83 / 0.00 ms  (average mu = 0.354, current mu = 0.139) allocation failure;


  <--- JS stacktrace --->

  FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
  ----- Native stack trace -----

  1: 0xb82d33 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/bin/node]
  2: 0xef0c50 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/bin/node]
  3: 0xef0f37 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/bin/node]
  4: 0x1102ad5  [/usr/bin/node]
  5: 0x111a958 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
  6: 0x10f0a71 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]      
  7: 0x10f1c05 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]     
  8: 0x10cf256 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
  9: 0x152b086 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
  10: 0x1964ef6  [/usr/bin/node]
  Aborted (core dumped)
  at makeError (/var/www/moonfolio/20240815200000/node_modules/execa/lib/error.js:60:11)
  at handlePromise (/var/www/moonfolio/20240815200000/node_modules/execa/index.js:118:26)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async _Task.task [as taskFn] (/var/www/moonfolio/20240815200000/node_modules/@redwoodjs/cli/dist/commands/buildHandler.js:142:11)
  at async _Task.run (/var/www/moonfolio/20240815200000/node_modules/listr2/dist/index.cjs:2049:11)


  Need help?
  - Not sure about something or need advice? Reach out on our Forum (​https://community.redwoodjs.com/​)
  - Think you've found a bug? Open an issue on our GitHub (​https://github.com/redwoodjs/redwood​)
  - Here's your unique error reference to quote: 'e21de684-cc2f-4fa6-bc67-03d7f360a6c4'
  ◼ Symlinking current release...
  ◼ Starting serve process for the first time...
  ◼ Saving serve state for future startup...
  ◼ Cleaning up old deploys...
  ◼ Disconnecting...

any help is welkom

hello @NICKLOUBSER I just ran into this same issue. I solved it by increasing the node heap memory limit.

Im running this on a tiny 512mb ram kvm, so i set the --max-old-space-size value to 460.

try this:

increase the node memory limit

nano ~/.bashrc

add the following line at the end of the file

export NODE_OPTIONS="--max-old-space-size=460"

reload the bashrc file

source ~/.bashrc