question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JavaScript heap out of memory with an unreleased npm package

See original GitHub issue

Description

I just tried to use np to release a package that hadn’t been released yet but I got a JavaScript heap out of memory error with a very fun looking stack trace 😂

➜  ember-deprecation-error git:(master) ✗ np

<--- Last few GCs --->

[55609:0x104907000]    11975 ms: Mark-sweep (reduce) 4093.4 (4112.0) -> 4093.4 (4113.0) MB, 13.1 / 0.0 ms  (average mu = 0.201, current mu = 0.001) last resort GC in old space requested
[55609:0x104907000]    11988 ms: Mark-sweep (reduce) 4093.4 (4112.0) -> 4093.4 (4113.0) MB, 13.0 / 0.0 ms  (average mu = 0.112, current mu = 0.001) last resort GC in old space requested


<--- JS stacktrace --->

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x101312195 node::Abort() (.cold.1) [/usr/local/bin/node]
 2: 0x1000ade29 node::Abort() [/usr/local/bin/node]
 3: 0x1000adf8f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 4: 0x1001f2407 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0x1001f23a3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 6: 0x1003a1fb5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
 7: 0x1003ab3ec v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 8: 0x100373a9d v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [/usr/local/bin/node]
 9: 0x10060a0c1 v8::internal::String::SlowFlatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::ConsString>, v8::internal::AllocationType) [/usr/local/bin/node]
10: 0x100720850 v8::internal::Runtime_StringSplit(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x100a85499 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
[1]    55609 abort      np

Steps to reproduce

I’m pretty sure the only special thing that I was doing was trying to release a package that hadn’t been released yet 🤔 I released using npm publish and then ran np again and it gave me the No commits found since previous release, continue? warning so I figured it was back working

Environment

np - latest (I re-installed after i saw the error first and it still happened) Node.js - I started on node 12 but then I installed a fresh Node 14 system-wide v14.17.6 npm - 7.22.0 Git - git version 2.30.1 (Apple Git-130) OS - macOs 11.5.2 (20G95)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
mansonacommented, Nov 22, 2021

Just a bump on this issue 👋

Does anyone have any pointers on how I should proceed with a fix for this? I don’t know too much about the internals of this so I got a bit stuck after investigating the “cause”. Any pointers or suggestions would be very much appreciated as I’m still hitting this nearly every time I’m running np

1reaction
mansonacommented, Sep 7, 2021

Do it wasn’t a large package, unless it was somehow including node modules which is very strange behaviour.

I noticed something after I posted this bug: it wasn’t just unreleased, I had also forgotten to create a remote repo

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - npm install - javascript heap out of memory
Just want to point out that in my case, I got a JavaScript heap out of memory error because my machine didn't have...
Read more >
[SOLVED] Fix JavaScript Heap Out Of Memory, NodeJS Heap ...
The simplest fix is to enforcing a memory limit for Node process like mentioned in the post, so it won't use memory beyond...
Read more >
How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
A common problem while working on a JavaScript Node.js project is the “JavaScript heap out of memory” error. This error usually occurs when ......
Read more >
JavaScript Heap Out Of Memory Error - OpenReplay Blog
How to solve the “Heap out of memory” error in JavaScript · Change the Node.js memory limits of your environment · “npm install”...
Read more >
JavaScript Heap Out of Memory - Position Is Everything
JavaScript heap out of memory is a common issue that occurs when there are a lot of processes happening concurrently. The default JavaScript...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found