CodeSandbox "Could Not Find Dependency" Error
Quick answer
This error means the browser bundler cannot resolve a package or its relative import. Check the package name and version in package.json, or move to a VM Sandbox for Node-heavy projects.
Most likely fix: Fix the dependency list
How to fix it
Try these in order — the most common fix is first.
1. Fix the dependency list
- Open the Dependencies panel and add the missing package
- Match versions of related packages (for example react and react-dom)
- Reload the preview
Did this fix it?2. Switch to a VM Sandbox
- For Node-dependent or unusual packages, create a VM Sandbox where npm install runs in a real environment
Did this fix it?
Symptoms
The preview shows DependencyNotFoundError or "Could not find module in path" for a package such as @babel/runtime or react-dom/client.
Why it happens
- Package missing or misspelled in package.json
- Version mismatch between packages
- A package the browser bundler cannot handle
This guide also covers
- codesandbox could not find dependency
- codesandbox cannot find module
- codesandbox dependency error
Still not working?
If CodeSandbox keeps failing, you're not alone. See every CodeSandbox problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
All not loading, error messages & connection guides →
StackBlitz "Cannot load native addon because loading addons is disabled" (StackBlitz)
Codespace Running in Recovery Mode: "This codespace is currently running in recovery mode due to a container error" (GitHub Codespaces)
Replit Workspace Not Loading (Replit)
Ona AWS Runner Failed: ROLLBACK_COMPLETE and ECS Circuit Breaker Errors (Gitpod)
Other CodeSandbox errors
- CodeSandbox 502 "Dev Server Has Not Started Yet" Error
- CodeSandbox Not Loading or Not Starting
- CodeSandbox VM Frozen: Credits Ran Out
- CodeSandbox Preview Not Showing for Private Sandbox
- CodeSandbox "Request Entity Too Large" Error on Import or Commit
- CodeSandbox "Only a Max of 250 Modules Is Allowed" Import Error
- CodeSandbox VM Slow or Out of Memory
- CodeSandbox Private Sandboxes on the Free Plan