最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

vue.js - Yarn build - Crashes error JavaScript heap out of memory - Stack Overflow

programmeradmin1浏览0评论

I have a Vue application. while running yarn build for that application it is failing with error as " FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"

Apparently not crash... only restart and the error appears again

yarn serve doesn't show any error

I've already try using --max_old_space_size , but it doesn't work.

Building for production...
<--- Last few GCs --->

[15106:0x104800000]    59679 ms: Scavenge 1309.5 (1404.6) -> 1308.7 (1405.1) MB, 17.1 / 0.0 ms  (average mu = 0.183, current mu = 0.186) allocation failure
[15106:0x104800000]    59705 ms: Scavenge 1320.1 (1415.6) -> 1319.2 (1416.1) MB, 11.5 / 0.0 ms  (average mu = 0.183, current mu = 0.186) allocation failure


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x0ed65f71e681 <JSObject>
    0: builtin exit frame: lastIndexOf(this=0x0ed64fe8cd29 <Very long string[2749756]>,0x0ed684c307e9 <String[1]\: \n>,0x0ed64fe8cd29 <Very long string[2749756]>)

    1: z(aka z) [0xed64d5f89f9] [/Users/aracelicanadas/Desktop/unilever/unilever_ui/node_modules/terser/dist/bundle.min.js:1] [bytecode=0xed694d21061 offset=15](this=0x0ed6cad826f1 <undefined>)
    2: prepend_ments [0xed64d5f86c1] ...

FATAL ERROR: Ineffective mark-pacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10003927a node::Abort() [/usr/local/Cellar/node/10.10.0/bin/node]
 2: 0x10003944b node::OnFatalError(char const*, char const*) [/usr/local/Cellar/node/10.10.0/bin/node]
 3: 0x1001aca27 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/10.10.0/bin/node]
 4: 0x1001ac9c8 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/10.10.0/bin/node]
 5: 0x10047f740 v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/Cellar/node/10.10.0/bin/node]
 6: 0x1004813b3 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/Cellar/node/10.10.0/bin/node]
 7: 0x10047ea79 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/Cellar/node/10.10.0/bin/node]
 8: 0x10047d964 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/Cellar/node/10.10.0/bin/node]
 9: 0x1004860bf v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/10.10.0/bin/node]
10: 0x100486108 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/10.10.0/bin/node]
11: 0x100465fef v8::internal::Factory::AllocateRawWithImmortalMap(int, v8::internal::PretenureFlag, v8::internal::Map*, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/10.10.0/bin/node]
12: 0x100467dbf v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/Cellar/node/10.10.0/bin/node]
13: 0x10054c801 v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/usr/local/Cellar/node/10.10.0/bin/node]
14: 0x1005679f4 v8::internal::String::LastIndexOf(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/usr/local/Cellar/node/10.10.0/bin/node]
15: 0x10024a531 v8::internal::Builtin_Impl_StringPrototypeLastIndexOf(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/Cellar/node/10.10.0/bin/node]
16: 0x354b4c8dc17d
17: 0x354b4c8918b5
18: 0x354b4d494285
19: 0x354b4d43de3c
20: 0x354b4c88a5a3
⠙  Building for production...

I have a Vue application. while running yarn build for that application it is failing with error as " FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"

Apparently not crash... only restart and the error appears again

yarn serve doesn't show any error

I've already try using --max_old_space_size , but it doesn't work.

Building for production...
<--- Last few GCs --->

[15106:0x104800000]    59679 ms: Scavenge 1309.5 (1404.6) -> 1308.7 (1405.1) MB, 17.1 / 0.0 ms  (average mu = 0.183, current mu = 0.186) allocation failure
[15106:0x104800000]    59705 ms: Scavenge 1320.1 (1415.6) -> 1319.2 (1416.1) MB, 11.5 / 0.0 ms  (average mu = 0.183, current mu = 0.186) allocation failure


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x0ed65f71e681 <JSObject>
    0: builtin exit frame: lastIndexOf(this=0x0ed64fe8cd29 <Very long string[2749756]>,0x0ed684c307e9 <String[1]\: \n>,0x0ed64fe8cd29 <Very long string[2749756]>)

    1: z(aka z) [0xed64d5f89f9] [/Users/aracelicanadas/Desktop/unilever/unilever_ui/node_modules/terser/dist/bundle.min.js:1] [bytecode=0xed694d21061 offset=15](this=0x0ed6cad826f1 <undefined>)
    2: prepend_ments [0xed64d5f86c1] ...

FATAL ERROR: Ineffective mark-pacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10003927a node::Abort() [/usr/local/Cellar/node/10.10.0/bin/node]
 2: 0x10003944b node::OnFatalError(char const*, char const*) [/usr/local/Cellar/node/10.10.0/bin/node]
 3: 0x1001aca27 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/10.10.0/bin/node]
 4: 0x1001ac9c8 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/10.10.0/bin/node]
 5: 0x10047f740 v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/Cellar/node/10.10.0/bin/node]
 6: 0x1004813b3 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/Cellar/node/10.10.0/bin/node]
 7: 0x10047ea79 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/Cellar/node/10.10.0/bin/node]
 8: 0x10047d964 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/Cellar/node/10.10.0/bin/node]
 9: 0x1004860bf v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/10.10.0/bin/node]
10: 0x100486108 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/10.10.0/bin/node]
11: 0x100465fef v8::internal::Factory::AllocateRawWithImmortalMap(int, v8::internal::PretenureFlag, v8::internal::Map*, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/10.10.0/bin/node]
12: 0x100467dbf v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/Cellar/node/10.10.0/bin/node]
13: 0x10054c801 v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/usr/local/Cellar/node/10.10.0/bin/node]
14: 0x1005679f4 v8::internal::String::LastIndexOf(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/usr/local/Cellar/node/10.10.0/bin/node]
15: 0x10024a531 v8::internal::Builtin_Impl_StringPrototypeLastIndexOf(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/Cellar/node/10.10.0/bin/node]
16: 0x354b4c8dc17d
17: 0x354b4c8918b5
18: 0x354b4d494285
19: 0x354b4d43de3c
20: 0x354b4c88a5a3
⠙  Building for production...

Share Improve this question edited May 28, 2019 at 15:53 tk421 5,9676 gold badges26 silver badges36 bronze badges asked May 28, 2019 at 11:32 Araceli Cañadas RuizAraceli Cañadas Ruiz 411 gold badge1 silver badge2 bronze badges 2
  • What changes have you made to your code since this started happening? Have you tried updating node and your packages? – Decade Moon Commented May 28, 2019 at 11:36
  • I updated node and it works!!! thanks a lot – Araceli Cañadas Ruiz Commented May 28, 2019 at 12:17
Add a ment  | 

1 Answer 1

Reset to default 6

Updating or using a bigger heap memory size won't fix the root of the problem.

The root is that you're probably including an infinite loop dependency in your package.json file.

That can happen if i.e your package name is "anAwesomePackage", and inside it's package.json dependencies, you list itself as a dependency like so:

package.json:

{
  "name": "anAwesomePackage",
  ...
  "dependencies": {
    "anAwesomePackage": "latest"
  }
}

npm is smart enough to figure what to do, yarn isn't.

发布评论

评论列表(0)

  1. 暂无评论