在 Ubuntu 20 ec2 实例中设置 Ionic 环境时出错
Error while setting-up Ionic environment in Ubuntu 20 ec2 instance
我正在尝试在 ubuntu 服务器上生成 Android 和 IOS 平台文件夹,以便我可以将它们传输到能够构建 . apk 和 .ipa 相同。我使用 Ionic CLI 6.18.1、@ionic/agular 5.9.3、cordova CLI: 10.0.0 和节点 14.18.1 成功地做到了这一点,但有很多使用 Ionic CLI 6.18.1、@ionic/agular 6.0.8、cordova CLI:11.0.0 和节点 16.14.0 升级 项目时出现问题。
我想详细了解为什么会发生这种情况,以及一些 document/video 我可以参考以解决同样的问题。
I have added the detailed error at the bottom
我经常遇到的错误,仅在 ec2 实例中是:
- 致命错误:达到堆限制分配失败 - JavaScript 堆内存不足 [e1]
- 新的 SubprocessError [e2] 处出错
我尝试过的解决方案:
解决致命错误:达到堆限制分配失败 - JavaScript 堆内存不足
设置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-高内存
详细错误:
[e1] 致命错误:达到堆限制分配失败 - 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(虚拟机)中进行 运行 系列测试得出了这个结论。
谢谢。
我正在尝试在 ubuntu 服务器上生成 Android 和 IOS 平台文件夹,以便我可以将它们传输到能够构建 . apk 和 .ipa 相同。我使用 Ionic CLI 6.18.1、@ionic/agular 5.9.3、cordova CLI: 10.0.0 和节点 14.18.1 成功地做到了这一点,但有很多使用 Ionic CLI 6.18.1、@ionic/agular 6.0.8、cordova CLI:11.0.0 和节点 16.14.0 升级 项目时出现问题。
我想详细了解为什么会发生这种情况,以及一些 document/video 我可以参考以解决同样的问题。
I have added the detailed error at the bottom
我经常遇到的错误,仅在 ec2 实例中是:
- 致命错误:达到堆限制分配失败 - JavaScript 堆内存不足 [e1]
- 新的 SubprocessError [e2] 处出错
我尝试过的解决方案:
解决致命错误:达到堆限制分配失败 - JavaScript 堆内存不足
设置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-高内存
详细错误:
[e1] 致命错误:达到堆限制分配失败 - 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(虚拟机)中进行 运行 系列测试得出了这个结论。
谢谢。