npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Javascript heap out of memory allocation after NPM Linking and running webpack

Bug report

What is the current behavior?
I was using NPM link just fine, and then the dependency I was NPM linking needed a little debugging of its own, and I linked two other modules to that module’s directory.
Then I tried to run npm run start from my create-react-app and I got this error below.

I then tried to unlink those two extra links to my originally linked module, but that has done nothing.

Now even though I have the same setup that I had before - just one link from my create-react-app app to my linked module - I get . this error every time, whenever anything is linked at all. I even get it after removing the previous folder, unlinking everything, creating the same dependency in a new folder and linking that.

Here’s the error:

<--- Last few GCs --->

[6630:0x102837000]    34096 ms: Mark-sweep 1309.1 (1442.1) -> 1296.9 (1443.1) MB, 1591.8 / 0.0 ms  (average mu = 0.148, current mu = 0.073) allocation failure scavenge might not succeed
[6630:0x102837000]    36476 ms: Mark-sweep 1310.0 (1443.1) -> 1298.1 (1445.1) MB, 2108.6 / 0.0 ms  (average mu = 0.130, current mu = 0.114) allocation failure scavenge might not succeed

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x1b1faafcfc7d]
Security context: 0x0b7d4829d9b1 <JSObject>
    1: _normalizePosition [0xb7d693b7e59] [/Users/realisation/Desktop/code/cra-etude/node_modules/@babel/generator/lib/buffer.js:~208] [pc=0x1b1fab8dbc2a](this=0x0b7d693f4ea9 <Buffer map = 0xb7d8d2e9631>,0x0b7d482db161 <String[5]: start>,0x0b7d12991f59 <SourceLocation map = 0xb7d9a03a061>,0x0b7d478825b1 <undefined>,0x0b7d478825b1 <undefined>)
    2: argument...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Writing Node.js report to file: report.20190701.142118.6630.001.json
Node.js report completed
 1: 0x1000667f8 node::Abort() [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 2: 0x100066f48 node::errors::TryCatchScope::~TryCatchScope() [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 3: 0x1001b50d7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 4: 0x1001b5074 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 5: 0x1005bbfb2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 6: 0x1005be4e3 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 7: 0x1005baa18 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 8: 0x1005b8bd5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
 9: 0x1005c547c v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
10: 0x1005c54ff v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
11: 0x1005946f4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
12: 0x100846f94 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/realisation/.nvm/versions/node/v11.12.0/bin/node]
13: 0x1b1faafcfc7d 
14: 0x1b1fab8dbc2a 

If the current behavior is a bug, please provide the steps to reproduce.
NPM link one module, then npm link that module to a couple other modules, and try to run npm run start from a create-react-app app.

Unlink all those modules and just link the first one once. See the messed up stuff.

I am on a Macbook Pro from 2017.

What is the expected behavior?
Expected successful behavior without bug? I can simply use my npm linked module. Bonus: I can use my npm linked module with that module linked to a couple other modules so I can debug multiple modules quickly.

Other relevant information:
webpack version: 4.29.6
Node.js version: 11.12.0
Operating System: MocOS Mojave 10.14.4
Additional tools: NPM 6.7.0