The command is,
npm run build -- --release
the output shows below,
[25302:0x48adf20] 91062 ms: Mark-sweep 492.4 (496.9) -> 491.7 (496.6) MB, 422.4 / 0.0 ms (+ 158.5 ms in 19 steps since start of marking, biggest step 18.8 ms, walltime since start of marking 643 ms) (average mu = 0.122, current mu = 0.097) allocation
0: ExitFrame [pc: 0x140de99]
1: StubFrame [pc: 0x1394c01]
Security context: 0x3825937808d1
1: 0xa1a640 node::Abort() [/usr/bin/node]
So, you need to check the RAM space in your instance/machine and set max-old-space-size it based on the your application utilization. Here, we configured with 2 GB space.
Now, you can execute the command again and the build should be executed successfully.