[BUG] always reporting Javascript heap out of memory when using `pnpm install @anthropic-ai/claude-code`

Resolved 💬 2 comments Opened Aug 7, 2025 by zombieyang Closed Aug 8, 2025

Environment

  • Platform (select one): All
  • Operating System: All
  • Terminal: Bash

Bug Description

use pnpm to install claude code SDK

Steps to Reproduce

  1. in any nodejs project
  2. run pnpm i @anthropic-ai/claude code

Expected Behavior

<!-- What you expected to happen -->

Actual Behavior

NODE_OPTIONS="--max_old_space_size=8192" pnpm i @anthropic-ai/claude-code
../..                                    |  WARN  `node_modules` is present. Lockfile only installation will make it out-of-date
../..                                    | Progress: resolved 498, reused 0, downloaded 0, added 0, done

dependencies:
+ @anthropic-ai/claude-code ^1.0.70

../..                                    |   +3 +
Downloading @anthropic-ai/claude-code@1.0.70: 54.84 MB/54.84 MB, done

<--- Last few GCs --->

[936184:0x7f9324002000]    12129 ms: Scavenge 397.0 (525.9) -> 397.0 (525.9) MB, pooled: 0 MB, 71.11 / 0.00 ms  (average mu = 0.993, current mu = 0.704) allocation failure; 
[936184:0x7f9324002000]    12330 ms: Scavenge 674.6 (803.5) -> 674.6 (803.5) MB, pooled: 0 MB, 27.32 / 0.00 ms  (average mu = 0.993, current mu = 0.704) allocation failure; 

FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xf1f241 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
 2: 0x13563a0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 3: 0x135648f v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0x15eef55  [node]
 5: 0x1aa009c  [node]
 6: 0x7f92ffe76636 
Aborted (core dumped)

Additional Context

Node.js in 24.4.1, pnpm 10.14.0

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗