node.js - Windows10 - fatal error : Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

标签 node.js windows npm

执行任何 npm 命令时 JavaScript 堆内存不足。 另外,我在用户文件夹中没有看到 .npmrc 文件

Node 版本最新:v10.15.1,npm:6.4.1

我尝试重新安装nodejs和npm 我尝试使用命令 node --max-old-space-size=8192 来增加大小

以及论坛中提供的其他命令,但没有任何帮助。粘贴上面的日志。

[ .................] \ fetchMetadata: sill install loadAllDepsIntoIdealTree
<--- Last few GCs --->

[25040:0000019200D9B400]   314378 ms: Scavenge 7987.0 (8133.8) -> 7985.4 (8134.8) MB, 15.4 / 0.0 ms  (average mu = 0.068, current mu = 0.028) allocation failure
[25040:0000019200D9B400]   314438 ms: Scavenge 7987.7 (8134.8) -> 7986.5 (8137.8) MB, 15.1 / 0.0 ms  (average mu = 0.068, current mu = 0.028) allocation failure
[25040:0000019200D9B400]   314524 ms: Scavenge 7989.2 (8137.8) -> 7987.8 (8148.3) MB, 16.8 / 0.0 ms  (average mu = 0.068, current mu = 0.028) allocation failure

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF60BC20EFA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810
 2: 00007FF60BBFA296 node::MakeCallback+4518
 3: 00007FF60BBFAC80 node_module_register+2160
 4: 00007FF60BE909BE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF60BE908EF v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF60C3CE954 v8::internal::Heap::MaxHeapGrowingFactor+11476
 7: 00007FF60C3C50B7 v8::internal::ScavengeJob::operator=+25543
 8: 00007FF60C3C362C v8::internal::ScavengeJob::operator=+18748
 9: 00007FF60C3C97A7 v8::internal::Heap::CreateFillerObjectAt+983
10: 00007FF60C24E87C v8::internal::interpreter::Interpreter::GetDispatchCountersObject+81388
11: 00007FF60BB79ACE v8::internal::StackGuard::ArchiveSpacePerThread+59982
12: 00007FF60BB7A0E3 v8::internal::StackGuard::ArchiveSpacePerThread+61539
13: 00007FF60BC643F4 uv_dlerror+2436
14: 00007FF60BC65003 uv_run+179
15: 00007FF60BC0185E node::NewContext+1966
16: 00007FF60BC02145 node::NewIsolate+725
17: 00007FF60BC02A34 node::Start+2004
18: 00007FF60BAA9719 node::MultiIsolatePlatform::MultiIsolatePlatform+601
19: 00007FF60C69DF28 v8::internal::compiler::OperationTyper::ToBoolean+142280
20: 00007FFE468A3034 BaseThreadInitThunk+20
21: 00007FFE48B53691 RtlUserThreadStart+33

最佳答案

对我来说,以下命令有效

node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod

关于node.js - Windows10 - fatal error : Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54660063/

相关文章:

angularjs - Angular 路由不适用于 Express

javascript - 如何在保护 api key 的同时使用 javascript api?

c - 无法读取 C 中的 UNICODE 文本文件

c++ - 如何为 Code Blocks 13.12 编译 boost 1.55.0 至 win7(32 位)?

php - brew install php55-intl 失败,无法安装 Composer

npm 相当于 `pip install -r requirements.txt`

node.js - 使用案例在 mongodb 中查找查询

javascript - 从匹配最小值的 json 数组返回单个 json 对象

windows - 如何以编程方式获取 vmmap 中显示的信息?

image - 将图像转换为jpg Angular 4