Next.jsBeginnerHigh severity
Next.js Module not found: Can't resolve
The bundler cannot resolve an imported package or local file from the importing module.
5-15 min Popularity 90/100 Verified 2026-07-21
What does this error mean?
Next.js followed an import path during development or build and could not map it to an installed package or an existing file.
Why does this happen?
- The package is not installed.
- The relative path or filename casing is wrong.
- A path alias is not configured correctly.
- A server-only dependency is imported into client code.
- The lockfile or node_modules directory is stale.
AI explanation
Plain-English analysis
The build graph contains an import edge that points nowhere. Check the exact import text, the importing file's location, and whether the target exists with matching letter case.
Quick fix
Terminal
npm install <missing-package> npx tsc --noEmit
Expected output: The development server or production build resolves the import.
Step-by-step fix
1Install the missing packageFor bare imports, confirm the package is listed in dependencies.71%
2Correct the path and casingLinux and Vercel filesystems are case-sensitive even when local Windows development is not.62%
3Fix the path alias configurationEnsure tsconfig paths and the actual source directory agree.36%
Alternative solutions
Vercel
Check filename casing and committed files.
A local Windows build can hide casing mistakes.
Monorepo
Declare the dependency in the package that imports it.
Do not rely on an accidentally hoisted transitive dependency.
Real example
Broken
typescript
import { Search } from "@/Components/Search";
// Actual path: src/components/search.tsxCorrected
typescript
import { Search } from "@/components/search";Frequently asked questions
The deployed filesystem is case-sensitive. Match directory and filename casing exactly.