TypeScript "TS2580: Cannot find name 'process'" - Fix Node Types
tsc does not know about Node globals like process, require, __dirname, or Buffer unless the Node type definitions are installed and included. TS2580 specifically suggests installing @types/node.
What this error means
Type-checking fails with error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? (or the same for require, __dirname, Buffer, global).
src/config.ts:1:13 - error TS2580: Cannot find name 'process'. Do you need to
install type definitions for node? Try `npm i --save-dev @types/node`.
1 const url = process.env.API_URL
~~~~~~~Common causes
@types/node not installed
The Node global type declarations are missing, so tsc has no definition for process, Buffer, require, etc. Common in front-end projects that nonetheless touch Node globals in build scripts.
Node types installed but excluded
A compilerOptions.types allowlist that omits node, or a lib/typeRoots setting that excludes it, hides the installed declarations from this compilation.
How to fix it
Install @types/node
npm install -D @types/nodeEnsure node types are included
If you pin types, list node; otherwise tsc auto-includes installed @types.
// tsconfig.json
{
"compilerOptions": {
"types": ["node", "vite/client"]
}
}How to prevent it
- Add
@types/nodewherever build scripts or config touch Node globals. - Avoid an over-restrictive
compilerOptions.typesallowlist. - Type-check with
tsc --noEmitin CI to catch missing globals.