繁体   English   中英

当我运行命令服务时,我得到无效的标记压缩接近堆限制分配失败 - JavaScript 堆出 memory 错误

[英]when i run the commande ng serve i get Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory error

我正在使用 angular 9 和 nodejs 12 当我输入ng serve时,我面临以下问题:

 C:\Users\homz\my-app>ng serve 93% after chunk asset optimization SourceMapDevToolPlugin vendor.js generate SourceMap <--- Last few GCs ---> [3568:01DA56B8] 252182 ms: Mark-sweep 190.4 (193.9) -> 190.3 (194.4) MB, 756.7 / 0.1 ms (+ 180.7 ms in 13 steps since start of marking, biggest step 177.8 ms, walltime since start of marking 945 ms) (average mu = 0.106, current mu = 0.008) allocation f[3568:01DA56B8] 253111 ms: Mark-sweep 190.6 (194.4) -> 190.6 (194.9) MB, 741.2 / 0.1 ms (+ 185.4 ms in 5 steps since start of marking, biggest step 184.4 ms, walltime since start of marking 929 ms) (average mu = 0.059, current mu = 0.003) allocation fa <--- JS stacktrace ---> ==== JS stack trace ========================================= 0: ExitFrame [pc: 00D59EF7] Security context: 0x03bc0469 <JSObject> 1: substr [03BC9C49](this=0x137835b5 <Very long string[12707]>,8) 2: getOriginalSource(aka getOriginalSource) [1372D9FD] [C:\Users\homz\my-app\node_modules\webpack-sources\lib\ReplaceSource.js:119] [bytecode=11CB9EFD offset=129](this=0x01f00279 <undefined>,0x0dcc4fd9 <Object map = 0AC1BF95>) 3: _replaceInStringNode [0514A3CD] [C:\Users\homz\my-app\node_mod... FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 008BBD7A v8::internal::Heap::PageFlagsAreConsistent+3050 C:\Users\homz\my-app>ng serve 93% after chunk asset optimization SourceMapDevToolPlugin vendor.js generate SourceMap <--- Last few GCs ---> [2608:01DC5228] 202474 ms: Mark-sweep 189.7 (193.2) -> 189.5 (193.9) MB, 892.7 / 0.1 ms (average mu = 0.081, current mu = 0.006) allocation failure scavenge might not succeed [2608:01DC5228] 203373 ms: Mark-sweep 190.4 (193.9) -> 190.3 (194.4) MB, 699.2 / 0.1 ms (+ 192.1 ms in 13 steps since start of marking, biggest step 186.9 ms, walltime since start of marking 899 ms) (average mu = 0.046, current mu = 0.009) allocation f <--- JS stacktrace ---> ==== JS stack trace ========================================= 0: ExitFrame [pc: 00DA9EF7] Security context: 0x03740469 <JSObject> 1: substr [03749C49](this=0x12f4c8e1 <Very long string[12707]>,8) 2: getOriginalSource(aka getOriginalSource) [12DF6839] [C:\Users\homz\my-app\node_modules\webpack-sources\lib\ReplaceSource.js:119] [bytecode=1169D81D offset=129](this=0x01d00279 <undefined>,0x04188745 <Object map = 0ADC3A5D>) 3: _replaceInStringNode [0441AAA5] [C:\Users\homz\my-app\node_mod... FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0090BD7A v8::internal::Heap::PageFlagsAreConsistent+3050 C:\Users\homz\my-app>ng serve 93% after chunk asset optimization SourceMapDevToolPlugin vendor.js generate SourceMap <--- Last few GCs ---> on[3480:01D856B8] 285281 ms: Mark-sweep 190.6 (193.9) -> 190.4 (194.7) MB, 1331.4 / 0.1 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1331 ms) (average mu = 0.050, current mu = 0.003) allocation fail[3480:01D856B8] 286329 ms: Mark-sweep 190.4 (194.7) -> 190.4 (194.7) MB, 1047.5 / 0.1 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1048 ms) (average mu = 0.033, current mu = 0.011) allocation fail <--- JS stacktrace ---> ==== JS stack trace ========================================= 0: ExitFrame [pc: 00C49EF7] Security context: 0x03580469 <JSObject> 1: _replaceInStringNode [04B70FB5] [C:\Users\homz\my-app\node_modules\webpack-sources\lib\ReplaceSource.js:~194] [pc=139AB658](this=0x116d6429 <Source map = 0B0003FD>,0x1313d791 <JSArray[63403]>,0x1313d769 <ReplacementEnumerator map = 0343FF85>,0x1313d851 <JSFunction getOriginalSource (sfi = 0F15DFED)>,0x13081c21 <String[13]\: if (false) {\n>,1663649,0x119b72e1 <O... FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 007ABD7A v8::internal::Heap::PageFlagsAreConsistent+3050

您可以尝试增加 memory 节点可以使用

export NODE_OPTIONS="--max-old-space-size=4096"

您也可以改为对特定文件执行此操作。 您可能想查看源映射替代品,例如 webpack devtool: eval option

我在另一个基于 webpack 的项目上遇到了类似的问题:

你也可以试试:

optimization: {
    minimize: false,
},

在你的 webpack.config.js

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM