# TS2307: Cannot find module 'x' or its corresponding type declarations.

**Code:** `TS2307` · **Category:** Node.js · **Seen on:** Node.js

TypeScript can’t resolve the import — the package isn’t installed, the path alias isn’t configured, or there are no types.

## 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

1. npm install the package (and @types/x if needed)
2. Configure "paths" in tsconfig and the bundler
3. Add declare module '*.svg' in a .d.ts

## Detailed fix by platform

### Node.js

1. 

```javascript
// global.d.ts
declare module '*.svg' { const src: string; export default src; }
```


## How to diagnose

1. **Import** — Package, alias or asset?
2. **Config** — tsconfig paths/moduleResolution

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nodejs/ts2307-cannot-find-module-or-type-declarations)
