问题
When I run ionic 3 project using "ionic serve" command than getting this error:
回答1:
same issue on centos server 7, but this solved my problem:
node --max-old-space-size=X node_modules/@angular/cli/bin/ng build --prod
Where X = (2048 or 4096 or 8192 o..) is the value of memory
回答2:
Try this solution which was pointed out in an old message on the forum: https://forum.ionicframework.com/t/3-7-0-ios-build-with-prod-not-working/107061/24
Open node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js
Change the first line from:
#!/usr/bin/env node
to
#!/usr/bin/env node --max-old-space-size=4096
Try values 1024 and 2048, but for a relatively large app you may need 4096.
回答3:
node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build --baseHref=/baseUrl/ --prod=true
回答4:
In my case, fix this problem installing NodeJs,version 12.10.0
回答5:
For me it was a problem with firebase package.
Only add "@firebase/database": "0.2.1", for your package.json, reinstall node_modules and works.
回答6:
Run this command in your project folder. Use serve instead of build
node --max_old_space_size=8000 node_modules/@angular/cli/bin/ng serve --prod --port=4202
回答7:
I got the same error message when I execute following statements in Visual Studio code. But I can build successfully when I execute same thing in windows command line.
npm install -g increase-memory-limit
increase-memory-limit
set NODE_OPTIONS=--max_old_space_size=4096
ng build -c deploy --build-optimizer --aot --prod --sourceMap
回答8:
Check your folder name. If your folder name having spaces, these kind of issues will generate. Rename without spaces. hope it will work.
来源:https://stackoverflow.com/questions/53230823/fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-failed-javas