Skip to content
Latchkey

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).

tsc output
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

Terminal
npm install -D @types/node

Ensure node types are included

If you pin types, list node; otherwise tsc auto-includes installed @types.

tsconfig.json
// tsconfig.json
{
  "compilerOptions": {
    "types": ["node", "vite/client"]
  }
}

How to prevent it

  • Add @types/node wherever build scripts or config touch Node globals.
  • Avoid an over-restrictive compilerOptions.types allowlist.
  • Type-check with tsc --noEmit in CI to catch missing globals.

Frequently asked questions

What causes ""TS2580: Cannot find name""?
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.
How do I fix "TS2580: Cannot find name"?
Install @types/node

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card