升级到 v8 后 Nativescript 无法编译应用程序 - JavaScript 堆内存不足

问题描述 投票:0回答:1

我将 Nativescript 项目从 v7 升级到 v8。 还必须升级 npm(现在是 10.2.4)和 Node 到 21.6.0

现在,当我执行 ns 构建“平台”时 - 我收到以下错误:

将“./app/app.scss”解析为“./app/app.ios.scss”

<--- Last few GCs --->

[16754:0x7ff1b0008000] 56755 ms:Mark-Compact 4076.5 (4143.4) -> 4076.0 (4143.4) MB,1652.96 / 0.00 ms(平均 mu = 0.215,当前 mu = 0.011)分配失败;清理可能不会成功

[16754:0x7ff1b0008000] 59306 ms:Mark-Compact 4077.9 (4143.4) -> 4077.5 (4150.4) MB,2537.71 / 0.00 ms(平均 mu = 0.103,当前 mu = 0.005)分配失败;清理可能不会成功

<--- JS stacktrace --->

致命错误:达到堆限制分配失败 - JavaScript 堆内存不足 ----- 本机堆栈跟踪 -----

1: 0x10b476fc0 节点::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/local/bin/node] 2: 0x10b64ca7c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node] 3: 0x10b84ce47 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node] 4: 0x10b84a978 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node] 5: 0x10b8402bb v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 6: 0x10b840b75 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 7: 0x10b8221b2 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node] 8: 0x10bc83d29 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node] 9: 0x10c0b5636 内置_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]

我尝试使用

export NODE_OPTIONS=--max_old_space_size=4096
将内存增加到荒谬的内存量 - 仍然出现该错误。

由于错误似乎是在编译 scss 文件时发生的,因此我还尝试添加一个空的 app.ios.scss 文件 - 仍然收到该错误...

有什么想法吗?

[编辑]

我还尝试清空 app.js 文件 - 仍然收到该错误。我的猜测是,sass 编译器一定有问题,尽管我也清空了 sass 文件。

node.js nativescript
1个回答
0
投票

我能够通过更新 sass 和 sass-loader 模块来解决这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.