Error fix
How to fix “Cannot find module (Node / bundler)”
The runtime or bundler could not resolve an import—missing package, wrong path, or build config.
Updated Apr 20, 2026
Fastest fix
Start here first. Step 1 fixes most cases—then work down the list.
- Install the package or fix the import path to match published exports.
- Align extensions (.js vs .ts) with moduleResolution and bundler targets.
- In monorepos, verify workspace protocol and symlinked packages.
What this means
Node or your bundler looked up a module specifier and failed—either nothing is installed, paths don’t match, or resolution rules differ between dev and prod.
Common causes
Missing dependency
Package not installed, workspace not linked, or optional dep skipped.
Path aliases
tsconfig paths not mirrored in the bundler or Jest config.
Step-by-step fix
Restore resolution
- Install the package or fix the import path to match published exports.
- Align extensions (.js vs .ts) with moduleResolution and bundler targets.
- In monorepos, verify workspace protocol and symlinked packages.
Related
FAQ
- Works locally, fails in CI?
- Check frozen lockfiles, NODE_ENV, and that devDependencies are installed when needed.
- ESM vs CJS?
- Use import/require consistent with package.json type and "exports" field.
- Next.js module not found?
- Server vs client components affect what can be imported—check "use client" boundaries.
Fix related issues
Still stuck? Try these related fixes next.
- Missing package.json fileNode/npm expected a package.json in this folder—the project root is wrong or the file was never created.
- pnpm unexpected storeThe content-addressable store path does not match the project—often after switching machines.
- Yarn Berry / PnP resolutionPlug’n’Play could not resolve a package—cache, constraints, or missing deps.
- npm peer dependency conflict (ERESOLVE)npm could not satisfy peer ranges—often a major version bump or duplicate packages.
- npm ERR! tracker idealtree already existsnpm’s internal dependency tree build hit a corrupted or locked state—often cache or concurrent installs.
Edit your error
Tweak the message and run again—we'll match an existing fix or generate a new page.
Original error message
Error: Cannot find module 'lodash'
