2

i have angular application running on aws code pipeline and suddenly it start throwing this error. i did lot of this including "node --max-old-space-size=8192" etc ..! but nothing resolve this error. can someone please help me to resolve this.

   To disable this warning use "ng config -g cli.warnings.versionMismatch false".

<--- Last few GCs --->

[181:0x4ab9280]    99247 ms: Mark-sweep 2028.9 (2081.8) -> 2018.6 (2087.2) MB, 1481.7 / 0.0 ms  (average mu = 0.125, current mu = 0.028) allocation failure scavenge might not succeed
[181:0x4ab9280]   100721 ms: Mark-sweep 2021.2 (2087.2) -> 2018.5 (2087.0) MB, 1464.8 / 0.0 ms  (average mu = 0.069, current mu = 0.006) allocation failure GC in old space requested


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x13cb519]
Security context: 0x1308cef008d1 <JSObject>
    1: add [0x1308cef0b101](this=0x09332a9b8e61 <Set map = 0x33764a780a29>,0x22118ef17ee9 <Scope map = 0x12cadd78a529>)
    2: addScopeSymbols1(aka addScopeSymbols1) [0x27c6ba252f61] [/codebuild/output/src879897097/src/node_modules/webpack/lib/optimize/ConcatenatedModule.js:~207] [pc=0x36ab68da2da6](this=0x09e7d26004b1 <undefined>,0x22118ef17ee9 <Scope map = 0x12...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa07f90 node::Abort() [ng build --configuration DEV]
 2: 0xa0839c node::OnFatalError(char const*, char const*) [ng build --configuration DEV]
 3: 0xb80d9e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng build --configuration DEV]
 4: 0xb81119 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng build --configuration DEV]
 5: 0xd2d875  [ng build --configuration DEV]
 6: 0xd2df06 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [ng build --configuration DEV]
 7: 0xd3a785 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [ng build --configuration DEV]
 8: 0xd3b635 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng build --configuration DEV]
 9: 0xd3e0ec v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng build --configuration DEV]
10: 0xd0502d v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::RootIndex, int, v8::internal::Object, v8::internal::AllocationType) [ng build --configuration DEV]
11: 0xd05120 v8::internal::Handle<v8::internal::FixedArray> v8::internal::Factory::NewFixedArrayWithMap<v8::internal::FixedArray>(v8::internal::RootIndex, int, v8::internal::AllocationType) [ng build --configuration DEV]
12: 0xf325bd v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::Allocate(v8::internal::Isolate*, int, v8::internal::AllocationType) [ng build --configuration DEV]
13: 0xf3266f v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::Rehash(v8::internal::Isolate*, v8::internal::Handle<v8::internal::OrderedHashSet>, int) [ng build --configuration DEV]
14: 0xf32c4b v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::EnsureGrowable(v8::internal::Isolate*, v8::internal::Handle<v8::internal::OrderedHashSet>) [ng build --configuration DEV]
15: 0x1029ac8 v8::internal::Runtime_SetGrow(int, unsigned long*, v8::internal::Isolate*) [ng build --configuration DEV]
16: 0x13cb519  [ng build --configuration DEV]
Aborted

[Container] 2020/12/13 15:41:31 Command did not exit successfully ng build --configuration $ENV exit status 134
[Container] 2020/12/13 15:41:31 Phase complete: BUILD State: FAILED
[Container] 2020/12/13 15:41:31 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: ng build --configuration $ENV. Reason: exit status 134
CrazyCoder
  • 153
  • 3
  • 17

3 Answers3

10

if you are using aws i solved it using this

Solution

1 Go to your pipeline from aws console

2 Click on edit then click on edit build stage Then click on that pencil icon

3 Add Environment variable Name - "NODE_OPTIONS" Value - "--max-old-space-size=8192" Type - "Plaintext" Click on done and save.

4 Click on release change it will start your pipeline again

  • FYI. Instead of a pipeline, I had to edit my build details and add the environment variable per this post: https://stackoverflow.com/a/69524664/2027793 I also had to uncheck the "Allow AWS Code Build to modify..." per this post: https://stackoverflow.com/a/66115889/2027793 – Rob.Kachmar Mar 07 '23 at 02:34
4

i fixed this using multiple options

  1. use node --max-old-space-size=4096
  2. remove lots of lots of duplicate css
  3. remove some of the duplicate js
CrazyCoder
  • 153
  • 3
  • 17
0

If you are working with an AWS EC2 instance and coming to this error try to choose an instance that has More Memory(RAM) instance. After doing this solved this error for me.

Supun Sandaruwan
  • 1,814
  • 19
  • 19