[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
- Run
claude - 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>
52 Comments
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
I think you need to reinstall. This seems like a partial install. We are working on improving our autoupdater to prevent this failure mode.
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.
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.jsonor similar@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.
I think so. I am working on tightening this up today
pnpm uninstall -g @anthropic-ai/claude-codepnpm install -g @anthropic-ai/claude-codepnpm approve-builds -gfixed it for me
+1 on this...
+1, versions:
Uninstall / reinstall did not work, but manually removing and installing did:
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
Also running into this with Node 22 on macOS / Apple Silicon.
I ran into the same issue. Does anyone know how to install and older version?
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@latestoutta fix it@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
pnpmfor package management, so I install Claude Code withpnpm i -g @anthropic-ai/claude-code. But the autoupdater is installing intonvm, which creates two copies of theclaude-code.When I had
yoga.wasm not founderror, I initially tried to re-installclaude-codewithpnpmto no success, just to realize thatnvminstallation is actually taking precedence AND that it's lackingyoga.wasmfile. I've manually removednvmcopy to switch back to (manually updated)pnpmone, and it started to work.But now I'm getting
✗ Auto-update failed · Try claude doctor or npm i -g @anthropic-ai/claude-codein the UI every time it tried to autoupdate. And I have to clean up thenvminstallation again, and manually install withpnpm.A theory is that there might be some interference between the
pnpmand thenvmcopies 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.
PS Really love Claude Code, have been using it a lot over the past couple of weeks.
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.
Bit me today. I get partial update failures _>90% of the time claude code tries to update itself_
(platform: Mac)
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-codethen when I try
npm i -g @anthropic-ai/claude-code@latestwithout 1st removing thenode_modules/@anthropic-ai/claude-codefolder I get this:The log:
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
I had to update node to the latest TLS. I was in v21
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?
Just happened to me, version: 1.0.31
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-codeif it's local, the command iscd ~/.claude/local && npm updateTurns 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 copynode_modules/@anthropic-ai/claude-code/cli.jsto a new location—it needs the other supporting files like yoga.wasm in its directory.Global
If the global install is giving you problems, you can always try
claude migrate-installeronce you get it running again. You may find the local installer to be a bit more reliable.Current version: 1.0.22Checking 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 updateThis will ensure you have access to the latest features and improvements.---
Claude Code Local Installer
This will install Claude Code to
~/.claude/localinstead of using a global npm installation.Press
Enterto continue orEscto exit.username@Macbook %It just kicks me out of using any commands at all.
---
Using your
claude migrate-installercommand and then running:rm -rf /Users/[username]/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-codeThen:
npm i -g @anthropic-ai/claude-code@latestWorked for me — at least for now.
The
claude updatewould crash before.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/claudethis is probably because of confusion on which node version you are currently using and the one you were using when installed claude.
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.
sudo rm -rf /opt/homebrew/lib/node_modules/@anthropic-ai/claude-codeThe 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@latestYou may try
sudo rm -rf /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code
if on mac
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
Hi did all of the above but still unable to get claude code to reinstall.
Here's the output
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
do you have an alias in your config file? try removing to get the global install and then run
claude migrate-installeragainI've had to reinstall Claude Code already twice in the last two days due to errors like these.
try our new native builds! https://docs.anthropic.com/en/docs/claude-code/setup#native-binary-installation-alpha
I fixed it by upgrading the node version (from v20.10.0 to v22.17.1)
For anyone use mac
Remove the existing global installation of Claude Code (if any)
Reinstall Claude Code globally
Noted: Do NOT use 'sudo' with the above command
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.
This is the one that worked for me.
Reinstall was the only thing I could do to get this resolved, seems to be an issue still.
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 started happening after I forcefully exited the
claudeprocess from my Mac activity monitor.This is the process that worked (finally!!) to solve the same issue to me (just insert yourusername appropriately):
bashrm -rf /Users/yourusername/.npm-global/lib/node_modules/@anthropic-ai/claude-code
bashrmdir /Users/yourusername/.npm-global/lib/node_modules/@anthropic-ai 2>/dev/null || true
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
bashnpm cache clean --force
bashnpm list -g @anthropic-ai/claude-code
and then install: npm install -g @anthropic-ai/claude-code
https://github.com/anthropics/claude-code/issues/1103#issuecomment-3178672538 This worked for me. I needed to
remove local cache/configfor it to workI've got the same issue. Re-installation is worked
cd ~/.claude/local && npm updatedid 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.
Recommended version LTS/JOD v22.18.0
This what worked for me. Thank you.
Reinstall should fix this, or try using the native installer: https://docs.anthropic.com/en/docs/claude-code/setup#native-binary-installation-beta.
_tl;dr:_
---
| 08/2025 | macOS | 😵💫
npm/pnpm/local/globa/etcconfigs |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.