TS2580, "Cannot find name 'process'. Do you need to install type definitions for node?", is reported when code uses a Node.js global and no declaration for it is loaded. TypeScript's own libraries describe the language and the browser, not Node.js; Node's globals come from the @types/node package, which is what the message's suggested command installs.
The checker picks this message when the config has no types list. With a types list that leaves node out, the same problem is TS2591, whose message adds "and then add 'node' to the types field".
At a glance
| Code | TS2580 |
|---|---|
| Message | Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. |
| TypeScript's category | error |
| Listed under | Modules and imports |
| Depends on | types |
| In .js files | Reported when the file is checked: checkJs in jsconfig.json, or // @ts-check at the top of the file |
The message is TypeScript's own text from its diagnostic messages file (Apache-2.0); {0} is filled in by tsc for each error.
What it looks like
const port = Number(process.env.PORT ?? 3000);error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
export { port };jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"typeRoots": ["./node_modules/@types"]
},
"include": ["*.js"]
} What causes it
@types/nodeis not installed in the project.- The config has no
typeslist (so every installed@typespackage would load if it were there).
How to fix it
Install @types/node
Run npm install --save-dev @types/node, ideally the major version matching the Node.js you run. The fixed example has it available and names it in types, which is what the quick-start setups on this site do.
const port = Number(process.env.PORT ?? 3000);
export { port };jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": ["node"]
},
"include": ["*.js"]
} About the example
This site's build has @types/node installed, so the failing example points typeRoots at its own empty node_modules/@types folder to stand for a project without it. In your project you would simply not have the package.
Under TypeScript 6.0 and 7.0
Every example on this page also runs under TypeScript 6.0.3 and 7.0.2 when this site is built. One of them reports something different from 5.9.3, the version the page describes; the ✗ on its badge links to its entry below.
types defaults to an empty list, so the hint names the types field
The pattern: A global from a package that is not installed (process, describe, it) in a config that does not set types.
Why: Only the 6.0 default types: [] causes this. The name is still missing in every version, but 6.0 and 7.0 report it with the code and message for a project that lists its types (TS2591 instead of TS2580, TS2593 instead of TS2582), which add "and then add 'node' to the types field in your tsconfig". Source: TypeScript 6.0 release notes: types now defaults to an empty list.
Node.js globals with no Node.js types installed server.js
- TypeScript 5.9.3
server.js(2,21): error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
- TypeScript 6.0.3differs from 5.9.3
server.js(2,21): error TS2591: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.
- TypeScript 7.0.2differs from 5.9.3
server.js(2,21): error TS2591: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.
What works in every version: Install the types and name them: "types": ["node"], plus your test runner's.
The example With @types/node installed (and named in types) on this page shows it, with the same result under every version.
Gotchas
requireitself is not reported in a.jsfile, because the checker readsrequire(...)calls as imports; the module name is then reported if it cannot be found (TS2307 for"fs"without the Node.js types).__dirnameand__filenameare reported as plain TS2304 without the hint. In ES modules they do not exist at all; Node.js offersimport.meta.dirnameandimport.meta.filenameinstead (from version 20.11, per its documentation).
Sources
- TSConfig Reference: types · TypeScript
- @types/node · npm
- Node.js: import.meta.dirname · Node.js documentation
- diagnosticMessages.json (TypeScript 5.9.3) · TypeScript on GitHub
Last reviewed 20 October 2026.