TypeScript: error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
TypeScript can't resolve a package because moduleResolution doesn't match how the package exports (package exports map) or paths aren't set.
error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?Did you mean to set the 'moduleResolution' option to 'nodenext'TS2792 Cannot find module Meaning
Modern packages use exports; TypeScript needs "moduleResolution": "bundler" (Vite/webpack/Next) or "node16"/"nodenext" (Node ESM), with a matching module (esnext/nodenext). Older "node" can't read exports. For path aliases add paths and baseUrl.
Common causes
moduleResolution: "classic"/"node"with ESM-only package exports- Missing
pathsfor aliases module/moduleResolutionmismatch- Package without types
- Deep import blocked by
exports
⚡ Quick fix
- Use
"module": "esnext", "moduleResolution": "bundler"for bundled apps "module": "nodenext", "moduleResolution": "nodenext"for Node ESM- Configure
pathsfor aliases
Detailed fix by platform
TypeScript
{ "compilerOptions": { "module": "esnext", "moduleResolution": "bundler" } }
How to diagnose
- Resolution — bundler/nodenext?
- Package — exports map?
- Paths — Aliases?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cannot find module './App.vue' or its corresponding type declarations TypeScript: error TS2307: Cannot find module './App.vue' or its corresponding type declarations.
- TS1192: Module has no default export TypeScript: error TS1192: Module '"./utils"' has no default export.
- TS1208: File cannot be compiled under '--isolatedModules' because it is considered a global script file TypeScript: error TS1208: 'index.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement
Most viewed in TypeScript
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026