我尝试在AWS Amplify上部署React应用程序,但收到以下错误:
Creating an optimized production build...
2023-01-05T07:21:24.092Z [WARNING]: <--- Last few GCs --->
[3710:0x48877c0] 225822 ms: Scavenge 1576.7 (1958.9) -> 1544.8 (1928.0) MB, 5.2 / 0.0 ms (average mu = 0.652, current mu = 0.467) allocation failure
[3710:0x48877c0] 226651 ms: Mark-sweep 1681.0 (2063.6) -> 1665.9 (1998.4) MB, 734.4 / 0.0 ms (average mu = 0.538, current mu = 0.316) allocation failure scavenge might not succeed
[3710:0x48877c0] 226745 ms: Scavenge 1683.9 (2004.2) -> 1668.2 (2000.4) MB, 2.8 / 0.0 ms (average mu = 0.538, current mu = 0.316) allocation failure
<--- JS stacktrace --->
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
2023-01-05T07:21:24.094Z [WARNING]: 1: 0xa389b0 node::Abort() [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.095Z [WARNING]: 2: 0x96e0af node::FatalError(char const*, char const*) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.095Z [WARNING]: 3: 0xbb7a4e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.096Z [WARNING]: 4: 0xbb7dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.096Z [WARNING]: 5: 0xd73fd5 [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.097Z [WARNING]: 6: 0xda496e v8::internal::EvacuateNewSpaceVisitor::Visit(v8::internal::HeapObject, int) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.097Z [WARNING]: 7: 0xdb09a6 v8::internal::FullEvacuator::RawEvacuatePage(v8::internal::MemoryChunk*, long*) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.098Z [WARNING]: 8: 0xd9cb3f v8::internal::Evacuator::EvacuatePage(v8::internal::MemoryChunk*) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.098Z [WARNING]: 9: 0xd9cdb8 v8::internal::PageEvacuationTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.098Z [WARNING]: 10: 0xd8f699 v8::internal::ItemParallelJob::Run() [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.099Z [WARNING]: 11: 0xdb2900 void v8::internal::MarkCompactCollectorBase::CreateAndExecuteEvacuationTasks<v8::internal::FullEvacuator, v8::internal::MarkCompactCollector>(v8::internal::MarkCompactCollector*, v8::internal::ItemParallelJob*, v8::internal::MigrationObserver*, long) [/root/.nvm/versions/node/v14.18.1/bin/node]
12: 0xdb319c v8::internal::MarkCompactCollector::EvacuatePagesInParallel() [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.100Z [WARNING]: 13: 0xdb3365 v8::internal::MarkCompactCollector::Evacuate() [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.100Z [WARNING]: 14: 0xdc5361 v8::internal::MarkCompactCollector::CollectGarbage() [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.101Z [WARNING]: 15: 0xd81628 v8::internal::Heap::MarkCompact() [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.101Z [WARNING]: 16: 0xd83118 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.102Z [WARNING]: 17: 0xd8655c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.102Z [WARNING]: 18: 0xd4bd2d v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.103Z [WARNING]: 19: 0xd45bb4 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.103Z [WARNING]: 20: 0xd47f01 v8::internal::FactoryBase<v8::internal::Factory>::NewRawTwoByteString(int, v8::internal::AllocationType) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.104Z [WARNING]: 21: 0x11344bc v8::internal::IncrementalStringBuilder::Extend() [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.104Z [WARNING]: 22: 0xe727dd v8::internal::JsonStringifier::SerializeString(v8::internal::Handle<v8::internal::String>) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.105Z [WARNING]: 23: 0xe71e09 v8::internal::JsonStringifier::SerializeString(v8::internal::Handle<v8::internal::String>) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.105Z [WARNING]: 24: 0xe77baa v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.106Z [WARNING]: 25: 0xe78978 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.106Z [WARNING]: 26: 0xe78978 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.106Z [WARNING]: 27: 0xe79d8f v8::internal::JsonStringify(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.107Z [WARNING]: 28: 0xc63f5f v8::internal::Builtin_JsonStringify(int, unsigned long*, v8::internal::Isolate*) [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:24.108Z [WARNING]: 29: 0x1446459 [/root/.nvm/versions/node/v14.18.1/bin/node]
2023-01-05T07:21:33.089Z [WARNING]: error Command failed with exit code 1.
2023-01-05T07:21:33.117Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2023-01-05T07:21:33.118Z [ERROR]: !!! Build failed
2023-01-05T07:21:33.118Z [ERROR]: !!! Non-Zero Exit Code detected
2023-01-05T07:21:33.220Z [INFO]: # Starting environment caching...
2023-01-05T07:21:33.229Z [INFO]: # Environment caching completed
Terminating logging...
如何查找并修复内存泄漏问题??
1条答案
按热度按时间aurhwmvo1#
我遇到了同样的问题,并根据官方Github存储库中的讨论解决了这个问题。
我插入了 * 环境变量 *,如下所示:
您可以在 * 应用程序设置/环境变量 * 下找到此部分。