我正在开发一款非常安静的离子Android应用程序。当我运行ionic build --prod时,出现ff错误:
--- Last few GCs --->
[4220:000002B5705AEDC0] 185812 ms: Mark-sweep 1382.2 (1425.5) -> 1381.6 (1424.5) MB, 1157.1 / 0.0 ms (average mu = 0.092, current mu = 0.040) allocation failure scavenge might not succeed
[4220:000002B5705AEDC0] 185823 ms: Scavenge 1382.4 (1424.5) -> 1381.8 (1425.0) MB, 6.1 / 0.0 ms (average mu = 0.092, current mu = 0.040) allocation failure
[4220:000002B5705AEDC0] 185831 ms: Scavenge 1382.6 (1425.0) -> 1382.0 (1425.5) MB, 4.2 / 0.0 ms (average mu = 0.092, current mu = 0.040) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 000002EC1505C5C1]
Security context: 0x00f46dd9e6e1 <JSObject>
1: symbolToName(aka symbolToName) [00000239DECFEC99] [C:\Users\Juls\Desktop\Chapel\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:~26322] [pc=000002EC16294DD8](this=0x027dfb2826f1 <undefined>,symbol=0x001449973021 <SymbolObject map = 0000006B919CC659>,context=0x0251729a2041 <Object map = 0000006B9199D6E9>,meaning...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF63489ECF5
2: 00007FF6348781A6
3: 00007FF634878BB0
4: 00007FF634B09AAE
5: 00007FF634B099DF
6: 00007FF635047724
7: 00007FF63503DE87
8: 00007FF63503C3FC
9: 00007FF635045377
10: 00007FF6350453F6
11: 00007FF634BE84B7
12: 00007FF634C8019A
13: 000002EC1505C5C1
[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts build --prod exited with exit code 134.
Re-running this command with the --verbose flag may provide more information.
我已经尝试了互联网上所有可能的解决方案,但是似乎都没有用。 这些是我尝试无法解决的问题的列表:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "--max_old_space_size=8192" "%~dp0\node_modules\@angular\cli\bin\ng" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "--max_old_space_size=8192" "%~dp0\node_modules\@angular\cli\bin\ng" %*
)
将node.cmd编辑为该
运行export NODE_OPTIONS=--max_old_space_size=4096 before running ionic build --prod
将大小增加到8096,仍然显示以上错误消息。
修改ng.cmd:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" --max_old_space_size=5048 "%~dp0\..\angular-cli\bin\ng" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max_old_space_size=5048 "%~dp0\..\angular-cli\bin\ng" %*
)
修改ngc.cmd:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" --max_old_space_size=5048 "%~dp0\..\@angular\compiler-cli\src\main.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max_old_space_size=5048 "%~dp0\..\@angular\compiler-cli\src\main.js" %*
)
以下是可以帮助您找到要做什么的技术信息列表:
Ionic:
ionic (Ionic CLI) : 4.12.0 (C:\Users\Juls\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.3
@ionic/app-scripts : 3.2.1
Cordova:
cordova (Cordova CLI) : 9.0.0
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 21 other plugins)
System:
Android SDK Tools : 26.1.1 (C:\Users\Juls\AppData\Local\Android\Sdk)
NodeJS : v10.14.1 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
答案 0 :(得分:1)
当@ angular-devkit / build-optimizer的版本旧时,我经常注意到这一点。我将其至少更新为版本0.11.4。
尝试使用npm i @angular-devkit/build-optimizer@0.11.4
或更高版本
答案 1 :(得分:0)
尝试将您的应用脚本降级为对我有用的3.1.4。