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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →