TS2304: Cannot find name 'x'.
TypeScript doesn’t know an identifier — a missing import, missing type definitions (e.g. for Node or Jest globals), or a typo.
Seen on:
Node.js
Meaning
Globals like process, require, describe, it need @types/node or @types/jest and the right "types"/"lib" settings.
Common causes
- Missing import
- @types/node or @types/jest not installed
- tsconfig "types" array excluding them
- DOM types missing from lib
⚡ Quick fix
- Import the symbol
- npm i -D @types/node @types/jest
- Add "types": ["node", "jest"] or remove a restrictive types array
- Add "DOM" to lib for browser globals
Detailed fix by platform
Node.js
"compilerOptions": { "types": ["node", "jest"], "lib": ["ES2022", "DOM"] }
How to diagnose
- Name — Which identifier?
- Source — Global or module?
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026