Yes, I also feel the same!
why there is no solution?
ionic-app-scripts build --prod --target cordova --platform android
[17:57:52] ionic-app-scripts 3.1.11
[17:57:52] build prod started …
[17:57:52] clean started …
[17:57:52] clean finished in 12 ms
[17:57:52] copy started …
[17:57:52] deeplinks started …
[17:57:53] deeplinks finished in 114 ms
[17:57:53] ngc started …
[17:58:55] ngc finished in 62.67 s
[17:58:55] preprocess started …
[17:58:55] preprocess finished in less than 1 ms
[17:58:55] webpack started …
[17:58:55] copy finished in 63.11 s
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node_module_register
2: v8::internal::FatalProcessOutOfMemory
3: v8::internal::FatalProcessOutOfMemory
4: v8::internal::NewUninitializedFixedArray
5: v8::internal::WasmDebugInfo::SetupForTesting
6: v8::internal::interpreter::BytecodeArrayRandomIterator::UpdateOffsetFromIndex
7: 0000028A2C3843C1
[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts build --prod --target cordova --platform android exited with exit code 3.
Re-running this command with the --verbose flag may provide more information.
net.js:704
throw new TypeError(
^
TypeError: Invalid data, chunk must be a string or buffer, not object
at WriteStream.Socket.write (net.js:704:11)
at process. (C:\Users\drnvs\AppData\Roaming\npm\node_modules\ionic\bin\ionic:9:63)
at emitTwo (events.js:126:13)
at process.emit (events.js:214:7)
at emitPendingUnhandledRejections (internal/process/promises.js:108:22)
at process._tickCallback (internal/process/next_tick.js:189:7)
I also faced the same issue, I searched on the Google, but no solution worked for me.
After searching almost for 6 hours I tried one hack that is
I replaced line no 1 at
node-modules/@ionic/app-scripts/bin/ionic-app-scripts.js
with the below line
“#!/usr/bin/env node --max_old_space_size=4096 --optimize_for_size --stack_size=4096”
(remove double quotes while replacing) and it worked for me as a miracle