Reputation: 2515
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
The command I usually use is npm run build --aot
After searching the web, I used the below command, but the result is the same.
npm run build --aot node --max-old-space-size=4096 ./node_modules/.bin/ionic-app-scripts
My project is big, and there was no error since I added two more pages. If I remove these pages am I able to make a build?
My Ionic information is below:
Ionic:
ionic (Ionic CLI) : 4.12.0 (C:\Users\saurabh\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.3
@ionic/app-scripts : 3.2.3
System:
NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
This issue is happening on this project only.
Upvotes: 0
Views: 1245
Reputation: 5742
I also get the same error.
Try this:
npm run build --aot --minifyjs --minifycss
If it doesn't help,
node --max-old-space-size=8192 /usr/local/bin/ionic npm run build --prod --release
Upvotes: 0
Reputation: 2515
In a terminal console:
export NODE_OPTIONS=--max_old_space_size=8096
If using Windows:
set NODE_OPTIONS=--max_old_space_size=8096
Run the above command and then run ionic build --prod
.
Upvotes: 2
Reputation: 1426
Just run the below command:
export NODE_OPTIONS="--max-old-space-size=8192"
Upvotes: 1