gpt4 book ai didi

node.js - 在 Ubuntu 20 ec2 实例中设置 Ionic 环境时出错

转载 作者:行者123 更新时间:2023-12-04 19:25:48 25 4
gpt4 key购买 nike

我正在尝试在 ubuntu 服务器上生成 Android 和 IOS 平台文件夹,以便我可以将其传输到能够为其构建 .apk 和 .ipa 的机器上。我用 成功地做到了这一点Ionic CLI 6.18.1、@ionic/agular 5.9.3、cordova CLI:10.0.0 和 Node 14.18.1 , 但有很多 升级时的问题 的项目Ionic CLI 6.18.1、@ionic/agular 6.0.8、cordova CLI:11.0.0 和 Node 16.14.0。
我想了解一些关于为什么会发生这种情况的详细信息,以及一些我可以引用的文档/视频来解决同样的问题。

I have added the detailed error at the bottom


我经常遇到的错误,仅在 ec2 实例中是:
  • fatal error :达到堆限制分配失败 - JavaScript 堆内存不足 [e1]
  • 新 SubprocessError [e2]
  • 出现错误

    我尝试过的解决方案:
    解决 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
  • 设置 NODE_OPTIONS=--max_old_space_size=8192
  • 更改了 package.json
    “脚本”:{
    "ng-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --configuration=prod",
    }
    npm 运行 ng-high-memory

  • 详细错误:
    [e1] fatal error :达到堆限制分配失败 - JavaScript 堆内存不足
    <--- Last few GCs --->

    [10229:0x5132ba0] 64697 ms: Scavenge 479.8 (500.1) -> 479.5 (500.1) MB, 3.4 / 0.0 ms (average mu = 0.445, current mu = 0.476) allocation failure
    [10229:0x5132ba0] 64721 ms: Scavenge 480.2 (500.1) -> 479.8 (504.1) MB, 22.5 / 0.0 ms (average mu = 0.445, current mu = 0.476) allocation failure


    <--- JS stacktrace --->

    FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
    1: 0xb09980 node::Abort() [ng run app:ionic-cordova-build --platform=browser]
    2: 0xa1c235 node::FatalError(char const, char const) [ng run app:ionic-cordova-build --platform=browser]
    3: 0xcf77be v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, bool) [ng run app:ionic-cordova-build --platform=browser]
    4: 0xcf7b37 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [ng run app:ionic-cordova-build --platform=browser]
    5: 0xeaf3d5 [ng run app:ionic-cordova-build --platform=browser]
    6: 0xebf09d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng run app:ionic-cordova-build --platform=browser]
    7: 0xec1d9e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng run app:ionic-cordova-build --platform=browser]
    8: 0xe83257 v8::internal::Factory::New(v8::internal::Handle<v8::internal::Map>, v8::internal::AllocationType) [ng run app:ionic-cordova-build --platform=browser]
    9: 0xe93141 v8::internal::Factory::NewProperSubString(v8::internal::Handle<v8::internal::String>, int, int) [ng run app:ionic-cordova-build --platform=browser]
    10: 0x12123a5 v8::internal::Runtime_StringSplit(int, unsigned long, v8::internal::Isolate) [ng run app:ionic-cordova-build --platform=browser]
    11: 0x15f0a99 [ng run app:ionic-cordova-build --platform=browser]
    Error
    [e2] 新的 SubprocessError 错误
    at new SubprocessError
    (/home/ec2-user/.nvm/versions/node/v16.14.0/lib/node_modules/@ionic/cli/node_modules/@ionic/utils-subprocess/dist/index.js:41:23)
    at ChildProcess.<anonymous>
    (/home/ec2-user/.nvm/versions/node/v16.14.0/lib/node_modules/@ionic/cli/node_modules/@ionic/utils-subprocess/dist/index.js:125:27)
    at ChildProcess.emit (node:events:520:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
    [ec2-user@ip-10-100-0-156 ionic]$

    最佳答案

    我能够通过将 RAM 从 1 GB 升级到 2 GB (t2.micro - t2.small) 来解决这个问题。
    我们通过复制相同的环境在VM(虚拟机)中运行一系列测试得出了这个结论。
    谢谢。

    关于node.js - 在 Ubuntu 20 ec2 实例中设置 Ionic 环境时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71184587/

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