[BUG] Error: Cannot find module './yoga.wasm'

Resolved 💬 52 comments Opened May 14, 2025 by Jflick58 Closed Aug 22, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [X] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: Can't even get this
  • Operating System: MacOS 15.4.1
  • Terminal: VS Code terminal and ITerm2

Bug Description

me@mymachine repo % claude
node:internal/modules/cjs/loader:1144
  const err = new Error(message);
              ^

Error: Cannot find module './yoga.wasm'
Require stack:
- /Users/justinflick/.nodenv/versions/20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Function.resolve (node:internal/modules/helpers:187:19)
    at file:///Users/justinflick/.nodenv/versions/20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:610:22809
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/justinflick/.nodenv/versions/20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js'
  ]
}

Node.js v20.11.0

Steps to Reproduce

  1. Run claude
  2. Be sad

Expected Behavior

Claude Code runs.

Actual Behavior

I get an error in the terminal and Claude Code doesn't launch.

Additional Context

Happened after a restart. I had been getting a lot of 529 errors before I restarted.

npm is installed via nodenv.

env vars:
export CLAUDE_CODE_USE_VERTEX=1
export CLOUD_ML_REGION=us-east5
export ANTHROPIC_VERTEX_PROJECT_ID=<project>

View original on GitHub ↗

52 Comments

younusmahmood · 1 year ago

Happened to me too. I just reinstalled claude but had to manually remove it first, npm uninstall wasnt working so had to do this:

rm -rf /Users/[yourusername]/.nvm/versions/node/v20.10.0/lib/node_modules/@anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code

Hoping it doesn't happen again

wolffiex collaborator · 1 year ago

I think you need to reinstall. This seems like a partial install. We are working on improving our autoupdater to prevent this failure mode.

pietrobs · 1 year ago

Same here.

I went out to lunch, the computer was left on, when I came back and tried to use it, it was no longer working.

wolffiex collaborator · 1 year ago

for folks having trouble, could you let me know the version? if claude won't start
cat /Users/justinflick/.nodenv/versions/20.11.0/lib/node_modules/@anthropic-ai/claude-code/package.json or similar

Jflick58 · 1 year ago

@wolffiex unfortunately I manually uninstalled and reinstalled and that fixed my problem. I'm guessing this may be a bug in the auto-updater based on my and @pietrobs experiences.

wolffiex collaborator · 1 year ago

I think so. I am working on tightening this up today

BrennerSpear · 1 year ago

pnpm uninstall -g @anthropic-ai/claude-code
pnpm install -g @anthropic-ai/claude-code
pnpm approve-builds -g

fixed it for me

iambryansanders · 1 year ago

+1 on this...

vgkids · 1 year ago

+1, versions:

❯ cat /Users/[REDACTED]/.nvm/versions/node/v18.18.0/lib/node_modules/@anthropic-ai/claude-code/package.json 
{
  "name": "@anthropic-ai/claude-code",
  "version": "0.2.118",
  "bin": {
    "claude": "cli.js"
  },
  "engines": {
    "node": ">=18.0.0"
  },
  "type": "module",
  "author": "Boris Cherny <boris@anthropic.com>",
  "license": "SEE LICENSE IN README.md",
  "description": "Use Claude, Anthropic's AI assistant, right from your terminal. Claude can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.",
  "homepage": "https://github.com/anthropics/claude-code",
  "bugs": {
    "url": "https://github.com/anthropics/claude-code/issues"
  },
  "scripts": {
    "prepare": "node -e \"if (!process.env.AUTHORIZED) { console.error('ERROR: Direct publishing is not allowed.\\nPlease use the publish-external.sh script to publish this package.'); process.exit(1); }\"",
    "preinstall": "node scripts/preinstall.js"
  },
  "dependencies": {},
  "optionalDependencies": {
    "@img/sharp-darwin-arm64": "^0.33.5",
    "@img/sharp-linux-arm": "^0.33.5",
    "@img/sharp-linux-x64": "^0.33.5",
    "@img/sharp-win32-x64": "^0.33.5"
  }
}%                                                                                                                                                                                                                

Uninstall / reinstall did not work, but manually removing and installing did:

❯ rm -rf /Users/[REDACTED]/.nvm/versions/node/v18.18.0/lib/node_modules/@anthropic-ai/claude-code
❯ npm i -g @anthropic-ai/claude-code                                                                       
nikolayv · 1 year ago

Just got this. Should it still be open? Worked 12hrs ago before I went to sleep.

https://claude.ai/share/82017526-bbc2-4d0b-bb59-b896ecf41a6e

Bug Report Summary:

Claude Code Version: 1.0.7
Node.js Version: v18.16.1
NPM Version: 9.5.1
OS: macOS (Apple Silicon - M1/M2 based on "MacBook Air")
Error: Missing yoga.wasm module
Installation: Global npm install

The issue appears to be that the yoga.wasm file is either:

Not included in the npm package distribution for v1.0.7
Not being correctly resolved relative to the CLI entry point
Potentially having architecture-specific issues on Apple Silicon

This is a critical packaging bug that completely prevents Claude Code from running. The yoga library is typically used for flexbox layout calculations, and the .wasm file is a WebAssembly module that needs to be distributed alongside the JavaScript files.
When reporting this to Anthropic:

Include all the version numbers you've provided
Mention it's a complete blocker (the tool won't start at all)
Note that it's affecting a global npm installation on macOS/Apple Silicon

davidjwiner · 1 year ago

Also running into this with Node 22 on macOS / Apple Silicon.

ha-le2-ts · 1 year ago

I ran into the same issue. Does anyone know how to install and older version?

node:internal/modules/cjs/loader:1048
  const err = new Error(message);
              ^
Error: Cannot find module './yoga.wasm'

Node.js v20.5.0
wolffiex collaborator · 1 year ago

This isn't an issue with the version, it's an error with a botched update. Assuming you are running with the global node install
npm i -g @anthropic-ai/claude-code@latest outta fix it

chemeris · 1 year ago

@wolffiex I've faced the same issue, and I think I have a lead. Or maybe it's a different issue, I'm not completely sure.

I use pnpm for package management, so I install Claude Code with pnpm i -g @anthropic-ai/claude-code. But the autoupdater is installing into nvm, which creates two copies of the claude-code.

When I had yoga.wasm not found error, I initially tried to re-install claude-code with pnpm to no success, just to realize that nvm installation is actually taking precedence AND that it's lacking yoga.wasm file. I've manually removed nvm copy to switch back to (manually updated) pnpm one, and it started to work.

But now I'm getting ✗ Auto-update failed · Try claude doctor or npm i -g @anthropic-ai/claude-code in the UI every time it tried to autoupdate. And I have to clean up the nvm installation again, and manually install with pnpm.

A theory is that there might be some interference between the pnpm and the nvm copies during the autoupdate.

It would also be great if the autoupdater detects (or asks for) the package manager and uses the one that I'm using to avoid creating a mess with different copies of the same package.

$ which claude
/home/ipse/.nvm/versions/node/v22.15.1/bin/claude
$ ll /home/ipse/.nvm/versions/node/v22.15.1/bin/claude
lrwxrwxrwx 1 ipse ipse 52 Jun  4 11:45 /home/ipse/.nvm/versions/node/v22.15.1/bin/claude -> '../lib/node_modules/@anthropic-ai/claude-code/cli.js'*

$ ll /home/ipse/.local/share/pnpm/global/5/node_modules/@anthropic-ai/claude-code
lrwxrwxrwx 1 ipse ipse 83 Jun  4 18:17 '/home/ipse/.local/share/pnpm/global/5/node_modules/@anthropic-ai/claude-code' -> '../../.pnpm/@anthropic-ai+claude-code@1.0.11/node_modules/@anthropic-ai/claude-code'/

PS Really love Claude Code, have been using it a lot over the past couple of weeks.

PabloRN · 1 year ago

Yeah, same for me. I had to go to .nvm and remove all installed on node versions of claude-code and then install it again.

jblachly · 1 year ago

Bit me today. I get partial update failures _>90% of the time claude code tries to update itself_

(platform: Mac)

Hustada · 1 year ago

rm -rf /Users/[username]/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code

then

npm i -g @anthropic-ai/claude-code@latest

worked for me.

philote · 1 year ago
rm -rf /Users/[username]/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code then npm i -g @anthropic-ai/claude-code@latest worked for me.

I have had to do this 4 times now. Seems like most reports I see are on Mac's (as am I).
It would be nice if this got fixed, it's annoying.

When this happens and I open claude code I see this Auto-update failed · Try claude doctor or npm i -g @anthropic-ai/claude-code

then when I try npm i -g @anthropic-ai/claude-code@latest without 1st removing the node_modules/@anthropic-ai/claude-code folder I get this:

npm i -g @anthropic-ai/claude-code@latest
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code
npm ERR! dest /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/.claude-code-ZQimwkIA
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code' -> '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/.claude-code-ZQimwkIA'

npm ERR! A complete log of this run can be found in: /Users/<user>/.npm/_logs/2025-06-14T02_40_35_719Z-debug-0.log

The log:

0 verbose cli /Users/<user>/.nvm/versions/node/v21.6.1/bin/node /Users/<user>/.nvm/versions/node/v21.6.1/bin/npm
1 info using npm@10.2.4
2 info using node@v21.6.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 0ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:/Users/<user>/.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:/Users/<user>/.nvm/versions/node/v21.6.1/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:setEnvs Completed in 1ms
15 timing config:load Completed in 5ms
16 timing npm:load:configload Completed in 5ms
17 timing config:load:flatten Completed in 1ms
18 timing npm:load:mkdirpcache Completed in 1ms
19 timing npm:load:mkdirplogs Completed in 0ms
20 verbose title npm i @anthropic-ai/claude-code@latest
21 verbose argv "i" "--global" "@anthropic-ai/claude-code@latest"
22 timing npm:load:setTitle Completed in 6ms
23 timing npm:load:display Completed in 1ms
24 verbose logfile logs-max:10 dir:/Users/<user>/.npm/_logs/2025-06-14T02_42_16_441Z-
25 verbose logfile /Users/<user>/.npm/_logs/2025-06-14T02_42_16_441Z-debug-0.log
26 timing npm:load:logFile Completed in 4ms
27 timing npm:load:timers Completed in 0ms
28 timing npm:load:configScope Completed in 0ms
29 timing npm:load Completed in 24ms
30 timing config:load:flatten Completed in 0ms
31 timing arborist:ctor Completed in 1ms
32 silly logfile start cleaning logs, removing 1 files
33 timing idealTree:init Completed in 3ms
34 silly logfile done cleaning log files
35 http fetch GET 200 https://registry.npmjs.org/@anthropic-ai%2fclaude-code 6ms (cache hit)
36 timing idealTree:userRequests Completed in 9ms
37 silly idealTree buildDeps
38 silly fetch manifest @anthropic-ai/claude-code@1.0.24
39 silly placeDep ROOT @anthropic-ai/claude-code@1.0.24 OK for:  want: 1.0.24
40 silly fetch manifest @img/sharp-linux-arm@^0.33.5
41 silly fetch manifest @img/sharp-linux-x64@^0.33.5
42 silly fetch manifest @img/sharp-win32-x64@^0.33.5
43 silly fetch manifest @img/sharp-darwin-x64@^0.33.5
44 silly fetch manifest @img/sharp-linux-arm64@^0.33.5
45 silly fetch manifest @img/sharp-darwin-arm64@^0.33.5
46 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-x64 5ms (cache hit)
47 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-x64 5ms (cache hit)
48 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm64 6ms (cache hit)
49 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-x64 6ms (cache hit)
50 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-arm64 7ms (cache hit)
51 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm 8ms (cache hit)
52 timing idealTree:#root Completed in 11ms
53 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-darwin-arm64@0.33.5 OK for: @anthropic-ai/claude-code@1.0.24 want: ^0.33.5
54 silly fetch manifest @img/sharp-libvips-darwin-arm64@1.0.4
55 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-darwin-x64@0.33.5 OK for: @anthropic-ai/claude-code@1.0.24 want: ^0.33.5
56 silly fetch manifest @img/sharp-libvips-darwin-x64@1.0.4
57 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-linux-arm@0.33.5 OK for: @anthropic-ai/claude-code@1.0.24 want: ^0.33.5
58 silly fetch manifest @img/sharp-libvips-linux-arm@1.0.5
59 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-linux-arm64@0.33.5 OK for: @anthropic-ai/claude-code@1.0.24 want: ^0.33.5
60 silly fetch manifest @img/sharp-libvips-linux-arm64@1.0.4
61 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-linux-x64@0.33.5 OK for: @anthropic-ai/claude-code@1.0.24 want: ^0.33.5
62 silly fetch manifest @img/sharp-libvips-linux-x64@1.0.4
63 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-win32-x64@0.33.5 OK for: @anthropic-ai/claude-code@1.0.24 want: ^0.33.5
64 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-x64 7ms (cache hit)
65 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-x64 6ms (cache hit)
66 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm 8ms (cache hit)
67 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-arm64 9ms (cache hit)
68 http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm64 8ms (cache hit)
69 timing idealTree:node_modules/@anthropic-ai/claude-code Completed in 12ms
70 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-darwin-arm64@1.0.4 OK for: @img/sharp-darwin-arm64@0.33.5 want: 1.0.4
71 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-darwin-arm64 Completed in 1ms
72 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-darwin-x64@1.0.4 OK for: @img/sharp-darwin-x64@0.33.5 want: 1.0.4
73 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-darwin-x64 Completed in 0ms
74 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-darwin-arm64 Completed in 0ms
75 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-darwin-x64 Completed in 0ms
76 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-linux-arm@1.0.5 OK for: @img/sharp-linux-arm@0.33.5 want: 1.0.5
77 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm Completed in 1ms
78 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm Completed in 0ms
79 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-linux-arm64@1.0.4 OK for: @img/sharp-linux-arm64@0.33.5 want: 1.0.4
80 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm64 Completed in 0ms
81 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm64 Completed in 0ms
82 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-linux-x64@1.0.4 OK for: @img/sharp-linux-x64@0.33.5 want: 1.0.4
83 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-x64 Completed in 1ms
84 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-x64 Completed in 0ms
85 timing idealTree:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-win32-x64 Completed in 0ms
86 timing idealTree:buildDeps Completed in 26ms
87 timing idealTree:fixDepFlags Completed in 0ms
88 timing idealTree Completed in 38ms
89 timing reify:loadTrees Completed in 39ms
90 timing reify:diffTrees Completed in 1ms
91 silly reify moves {}
92 timing reify:retireShallow Completed in 1ms
93 timing reify:createSparse Completed in 1ms
94 timing reify:loadBundles Completed in 0ms
95 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-x64
96 silly reify mark deleted [
96 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-x64'
96 silly reify ]
97 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm64
98 silly reify mark deleted [
98 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm64'
98 silly reify ]
99 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm
100 silly reify mark deleted [
100 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm'
100 silly reify ]
101 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-darwin-x64
102 silly reify mark deleted [
102 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-darwin-x64'
102 silly reify ]
103 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-win32-x64
104 silly reify mark deleted [
104 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-win32-x64'
104 silly reify ]
105 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-x64
106 silly reify mark deleted [
106 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-x64'
106 silly reify ]
107 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm64
108 silly reify mark deleted [
108 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm64'
108 silly reify ]
109 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm
110 silly reify mark deleted [
110 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm'
110 silly reify ]
111 verbose reify failed optional dependency /Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-darwin-x64
112 silly reify mark deleted [
112 silly reify   '/Users/<user>/.nvm/versions/node/v21.6.1/lib/node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-darwin-x64'
112 silly reify ]
113 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-x64 Completed in 3ms
114 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm64 Completed in 3ms
115 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-linux-arm Completed in 2ms
116 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-darwin-x64 Completed in 2ms
117 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-win32-x64 Completed in 2ms
118 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-x64 Completed in 2ms
119 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm64 Completed in 2ms
120 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-linux-arm Completed in 2ms
121 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-darwin-x64 Completed in 2ms
122 silly tarball no local data for @anthropic-ai/claude-code@https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-1.0.24.tgz. Extracting by manifest.
123 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-darwin-arm64 Completed in 88ms
124 timing reifyNode:node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-darwin-arm64 Completed in 108ms
125 http fetch GET 200 https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-1.0.24.tgz 2309ms (cache miss)
126 timing reifyNode:node_modules/@anthropic-ai/claude-code Completed in 2318ms
127 timing reify:unpack Completed in 2318ms
128 timing reify:unretire Completed in 1ms
129 timing build:queue Completed in 1ms
130 info run @anthropic-ai/claude-code@1.0.24 preinstall node_modules/@anthropic-ai/claude-code node scripts/preinstall.js
131 info run @anthropic-ai/claude-code@1.0.24 preinstall { code: 0, signal: null }
132 timing build:run:preinstall:node_modules/@anthropic-ai/claude-code Completed in 160ms
133 timing build:run:preinstall Completed in 160ms
134 timing build:link:node_modules/@anthropic-ai/claude-code Completed in 0ms
135 timing build:link Completed in 0ms
136 timing build:deps Completed in 161ms
137 timing build Completed in 161ms
138 timing reify:build Completed in 161ms
139 timing reify:trash Completed in 1ms
140 timing reify Completed in 2528ms
141 silly ADD node_modules/@anthropic-ai/claude-code
142 silly ADD
143 silly ADD
144 silly ADD
145 silly ADD
146 silly ADD node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-libvips-darwin-arm64
147 silly ADD
148 silly ADD
149 silly ADD
150 silly ADD
151 silly ADD
152 silly ADD node_modules/@anthropic-ai/claude-code/node_modules/@img/sharp-darwin-arm64
153 timing command:i Completed in 2531ms
154 verbose exit 0
155 timing npm Completed in 2618ms
156 info ok
Hubert-airspace-intelligence · 1 year ago

https://github.com/oven-sh/bun/issues/15639

It seems the same issue has been solved in 'ink' by replacing yoga-wasm-web dependency with yoga-layout.

I got bit by this today, platform Mac, problem appeared after system update

vasco3 · 1 year ago

I had to update node to the latest TLS. I was in v21

tylerjames · 1 year ago
Same here. I went out to lunch, the computer was left on, when I came back and tried to use it, it was no longer working.

Just had the exact same thing happen to me. Going out to lunch seems to be a common denominator.

Has anyone made a Lunch MCP so Claude doesn't feel left out?

PetrBrabec · 1 year ago

Just happened to me, version: 1.0.31

wolffiex collaborator · 1 year ago

For folks running in to this, are you generally running the global install or the local one? If you have a global install, you can usually recover by going npm install -g @anthropic-ai/claude-code if it's local, the command is cd ~/.claude/local && npm update

Turns out npm update (which we use for the existing autoupdater) has very poor automaticity. This means you can get a partial update that's missing some files. Also note that you can't just copy node_modules/@anthropic-ai/claude-code/cli.js to a new location—it needs the other supporting files like yoga.wasm in its directory.

jblachly · 1 year ago
For folks running in to this, are you generally running the global install or the local one?

Global

wolffiex collaborator · 1 year ago

If the global install is giving you problems, you can always try claude migrate-installer once you get it running again. You may find the local installer to be a bit more reliable.

Hustada · 1 year ago
If the global install is giving you problems, you can always try claude migrate-installer once you get it running again. You may find the local installer to be a bit more reliable.

Current version: 1.0.22
Checking for updates...
New version available: 1.0.31 (current: 1.0.22)
Installing update...
Using global installation update method...
Error: Failed to install update
Or consider migrating to a local installation with:
/migrate-installer

claude /migrate-installer
✻ Welcome to Claude Code!
/help for help, /status for your current setup
cwd: /Users/username/Projects/

It looks like your version of Claude Code (1.0.22) needs an update.
A newer version (1.0.24 or higher) is required to continue.

To update, please run:

claude update

This will ensure you have access to the latest features and improvements.

---

Claude Code Local Installer
This will install Claude Code to ~/.claude/local instead of using a global npm installation.
Press Enter to continue or Esc to exit.

username@Macbook %

It just kicks me out of using any commands at all.

---

Using your claude migrate-installer command and then running:

rm -rf /Users/[username]/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code

Then:

npm i -g @anthropic-ai/claude-code@latest

Worked for me — at least for now.
The claude update would crash before.

wolffiex collaborator · 1 year ago

cool, @Hustada we just updated the minimum version so lots of users will be hitting something like this today
after migrating the installer, you'll want to source your config file or otherwise add an alias to the install location (usually ~/.claude/local/claude

du2x · 1 year ago

this is probably because of confusion on which node version you are currently using and the one you were using when installed claude.

michael-r-martin · 1 year ago

Just happened for me. Issue was claude attempted an auto update while I was in an area of patchy wifi. Guessing the partial install wasn't handled well. Deleting the claude folder was necessary in order to install again.

AbubakrChan · 1 year ago

sudo rm -rf /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code

The above command worked for me on mac, this way I was able to remove claude code and then I installed it back using

npm i -g @anthropic-ai/claude-code@latest

AbubakrChan · 1 year ago
Just happened for me. Issue was claude attempted an auto update while I was in an area of patchy wifi. Guessing the partial install wasn't handled well. Deleting the claude folder was necessary in order to install again.

You may try

sudo rm -rf /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code

if on mac

haejinjo · 1 year ago

For those running into the npm npm ERR! ENOTEMPTY: directory not empty error...
This occurs when npm can't cleanly uninstall the package because some files are locked or in use. Here's how to resolve it:

Try Force

npm uninstall -g @anthropic-ai/claude-code --force
npm install -g @anthropic-ai/claude-code

Try manual removal and clean cache instead of uninstall

Stop any running processes that might be using the files

pkill -f claude-code

Manually remove the installation directory

Replace <your-node-modules-path> with your actual global node_modules path

rm -rf <your-node-modules-path>/@anthropic-ai/claude-code

Also remove any temporary directories that might exist

rm -rf <your-node-modules-path>/@anthropic-ai/.claude-code-*

Clear npm cache

npm cache clean --force

Reinstall the package

npm install -g @anthropic-ai/claude-code

mercurialsolo · 12 months ago

Hi did all of the above but still unable to get claude code to reinstall.

Here's the output

claude
node:internal/modules/cjs/loader:1225
  const err = new Error(message);
              ^

Error: Cannot find module './yoga.wasm'
Require stack:
- /Users/barada/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Function.resolve (node:internal/modules/helpers:146:19)
    at file:///Users/<Username>/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:553:22855
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/<Username>/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js'
  ]
}

Node.js v22.14.0

The only thing yet to try is nuking the ~/.claude directory - won't I lose all project context with it?

What I have tried so far

pkill -f claude-code
npm uninstall -g @anthropic-ai/claude-code --force
rm -rf ~/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code
rm -rf ~/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/.claude-code-*
npm install -g @anthropic-ai/claude-code

Here's what else I tried

cd ~/.claude/local/ && npm update 
npm error code ENOTEMPTY
npm error syscall rename
npm error path /Users/<Username>/.claude/local/node_modules/@anthropic-ai/claude-code
npm error dest /Users/<Username>/.claude/local/node_modules/@anthropic-ai/.claude-code-WrOLATPY
npm error errno -66
npm error ENOTEMPTY: directory not empty, rename '/Users/<Username>/.claude/local/node_modules/@anthropic-ai/claude-code' -> '/Users/<Username>/.claude/local/node_modules/@anthropic-ai/.claude-code-WrOLATPY'
npm error A complete log of this run can be found in: /Users/<Username>/.npm/_logs/2025-07-17T02_03_43_639Z-debug-0.log
wolffiex collaborator · 12 months ago

do you have an alias in your config file? try removing to get the global install and then run claude migrate-installer again

TeemuSo · 12 months ago

I've had to reinstall Claude Code already twice in the last two days due to errors like these.

wolffiex collaborator · 12 months ago
ryanzzff · 11 months ago

I fixed it by upgrading the node version (from v20.10.0 to v22.17.1)

HadesPTIT · 11 months ago

For anyone use mac
Remove the existing global installation of Claude Code (if any)

rm -rf /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code

Reinstall Claude Code globally

npm install -g @anthropic-ai/claude-code

Noted: Do NOT use 'sudo' with the above command

danno2000 · 11 months ago

I tried having it installed globally via npm and locally via pnpm, and started seeing this issue. I removed the local pnpm install of Claude Code and it started working again.

math0ne · 11 months ago
sudo rm -rf /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code The above command worked for me on mac, this way I was able to remove claude code and then I installed it back using npm i -g @anthropic-ai/claude-code@latest

This is the one that worked for me.

james-shorthand · 11 months ago

Reinstall was the only thing I could do to get this resolved, seems to be an issue still.

No898 · 11 months ago

Not sure if there was some update or something, but from nowhere i just started mac today and it was broke, just the reinstall as everyone mention here works.

Check paths

which claude
npm list -g @anthropic-ai/claude-code
npm root -g

Force remove the broken installation

rm -rf "$(npm root -g)/@anthropic-ai/claude-code"

(Optional but recommended) Remove local cache/config

rm -rf ~/.config/claude ~/.cache/claude ~/.claude ~/.anthropic

Clean reinstall

npm i -g @anthropic-ai/claude-code@latest

jamesone · 11 months ago

This started happening after I forcefully exited the claude process from my Mac activity monitor.

nicolacerato · 11 months ago

This is the process that worked (finally!!) to solve the same issue to me (just insert yourusername appropriately):

  1. Manually remove the directory

bashrm -rf /Users/yourusername/.npm-global/lib/node_modules/@anthropic-ai/claude-code

  1. Also remove the parent directory if empty

bashrmdir /Users/yourusername/.npm-global/lib/node_modules/@anthropic-ai 2>/dev/null || true

  1. Remove any symbolic links

Check if there are links in the bin directory:
bashls -la /Users/yourusername/.npm-global/bin/ | grep claude
If you find any links, remove them:
bashrm /Users/yourusername/.npm-global/bin/claude-code

  1. Clean npm cache

bashnpm cache clean --force

  1. Verify removal

bashnpm list -g @anthropic-ai/claude-code

and then install: npm install -g @anthropic-ai/claude-code

Nickiam7 · 11 months ago

https://github.com/anthropics/claude-code/issues/1103#issuecomment-3178672538 This worked for me. I needed to remove local cache/config for it to work

# (Optional but recommended) Remove local cache/config rm -rf ~/.config/claude ~/.cache/claude ~/.claude ~/.anthropic
ndndien · 11 months ago

I've got the same issue. Re-installation is worked

IonMich · 11 months ago
For folks running in to this, are you generally running the global install or the local one? If you have a global install, you can usually recover by going npm install -g @anthropic-ai/claude-code if it's local, the command is cd ~/.claude/local && npm update Turns out npm update (which we use for the existing autoupdater) has very poor automaticity. This means you can get a partial update that's missing some files. Also note that you can't just copy node_modules/@anthropic-ai/claude-code/cli.js to a new location—it needs the other supporting files like yoga.wasm in its directory.

cd ~/.claude/local && npm update did not work for me in my local installation. What worked instead was:

cd ~/.claude/local && rm -rf node_modules && npm update.

Second time I am facing this issue in three days.

0xjgv · 11 months ago

Recommended version LTS/JOD v22.18.0

SaidiAli · 11 months ago
Not sure if there was some update or something, but from nowhere i just started mac today and it was broke, just the reinstall as everyone mention here works. # Check paths which claude npm list -g @anthropic-ai/claude-code npm root -g # Force remove the broken installation rm -rf "$(npm root -g)/@anthropic-ai/claude-code" # (Optional but recommended) Remove local cache/config rm -rf ~/.config/claude ~/.cache/claude ~/.claude ~/.anthropic # Clean reinstall npm i -g @anthropic-ai/claude-code@latest

This what worked for me. Thank you.

bcherny collaborator · 10 months ago

Reinstall should fix this, or try using the native installer: https://docs.anthropic.com/en/docs/claude-code/setup#native-binary-installation-beta.

Olshansk · 10 months ago

_tl;dr:_

curl -fsSL https://claude.ai/install.sh | bash -s latest

---

| 08/2025 | macOS | 😵‍💫 npm/pnpm/local/globa/etc configs |

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.