TS2307: Cannot find module 'x' or its corresponding type declarations.
TypeScript can’t resolve the import — the package isn’t installed, the path alias isn’t configured, or there are no types.
or its corresponding type declarations Meaning
TS resolves modules using tsconfig (moduleResolution, baseUrl, paths). Path aliases (@/components) need both tsconfig paths and bundler config. Non-code imports (.css, .svg) need declarations.
Common causes
- Package not installed
- Path alias missing in tsconfig
- Importing .css/.svg without a declaration
- moduleResolution mismatch (node16/bundler)
⚡ Quick fix
- npm install the package (and @types/x if needed)
- Configure "paths" in tsconfig and the bundler
- Add declare module '*.svg' in a .d.ts
Detailed fix by platform
Node.js
- javascript
// global.d.ts declare module '*.svg' { const src: string; export default src; }
How to diagnose
- Import — Package, alias or asset?
- Config — tsconfig paths/moduleResolution
🔧 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
Most viewed in Node.js
Other ways to find it
Where this error sits
Origin: Application & API. 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 15 Oct 2026