且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ionic cordova build android --prod 中的错误

更新时间:2023-01-24 22:28:25

通过修改我在 C:UsersAppDataRoaming pm 中的 ionic.cmd 文件添加解决--max_old_space_size.我将我的设置为 8096.

@if EXIST "%~dp0
ode.exe" ("%~dp0
ode.exe" --max_old_space_size=8096 "%~dp0
ode_modulesionicinionic" %*) 别的 (@SETLOCAL@set PATHEXT=%PATHEXT:;.JS;=;%节点 --max_old_space_size=8096 "%~dp0
ode_modulesionicinionic" %*)

祝你好运!查看实际来源:https://github.com/ionic-team/ionic-cli/issues/1453

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Error when running command: ionic cordova build android --prod

Note: that ionic build android, ionic run android and ionic serve all works fine.

I've read many topics that says once the project gets bigger, it stops working.

It was working the day before issue arrive. It stopped working as we added more files and JSON for translation of app in multi-language.

Is it a known issue? Is there any solution?

PLEASE CHECK FOR MORE DETAIL : https://youtu.be/oCN7iSt8rzg

Attached Error Image:

Ionic Info:

Resolved by modifying my ionic.cmd file in C:UsersAppDataRoaming pm by adding --max_old_space_size. I set mine to 8096.

@if EXIST "%~dp0
ode.exe" (
"%~dp0
ode.exe" --max_old_space_size=8096 "%~dp0
ode_modulesionicinionic" %*
) ELSE (
@SETLOCAL
@set PATHEXT=%PATHEXT:;.JS;=;%
node --max_old_space_size=8096 "%~dp0
ode_modulesionicinionic" %*
)

Good luck! Check Actual Source: https://github.com/ionic-team/ionic-cli/issues/1453