gpt4 book ai didi

javascript - Ionic 3 JavaScript 堆内存不足

转载 作者:行者123 更新时间:2023-12-02 23:47:59 25 4
gpt4 key购买 nike

我正在开发一个 ionic 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 编辑为该内容

在运行 ionic build --prod 之前运行 export NODE_OPTIONS=--max_old_space_size=4096将大小增加到 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

最佳答案

当 @angular-devkit/build-optimizer 的版本较旧时,我经常注意到这一点。我会将其更新到至少版本 0.11.4。

尝试npm i @angular-devkit/build-optimizer@0.11.4或更新版本

关于javascript - Ionic 3 JavaScript 堆内存不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55769671/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com