Report #77285
[bug\_fix] Cannot find name 'process'. Do you need to install type definitions for node? Try \`npm i --save-dev @types/node\`. \(TS2580\) OR Cannot find name 'Buffer'
Run \`npm install --save-dev @types/node\` \(or yarn/pnpm equivalent\) and ensure that \`tsconfig.json\` does not have a restrictive \`types: \[\]\` array that explicitly excludes "node". If \`types\` is specified, add "node" to the list: \`"types": \["node", "jest"\]\`. Root cause: TypeScript's default library \(\`lib.d.ts\`\) defines browser globals \(like \`window\`, \`document\`\) but does not include Node.js-specific globals \(\`process\`, \`Buffer\`, \`\_\_dirname\`\). These are provided by the \`@types/node\` package from DefinitelyTyped. If this package is not installed, or if \`tsconfig.json\` explicitly limits which \`@types\` packages are included via the \`types\` compiler option, TypeScript cannot resolve the \`process\` identifier.
Journey Context:
A developer clones a backend repository and runs \`npm install\`. The \`package.json\` has \`typescript\` but \`@types/node\` is missing \(perhaps devDependency was lost\). They open \`src/index.ts\` and see red squiggles under \`process.env.PORT\`. Hovering reveals "Cannot find name 'process'... install @types/node". Developer runs \`npm i -D @types/node\`. Expectation: errors gone. Reality: errors persist. Developer reloads VS Code window, restarts TS server, no change. Desperation sets in. They examine \`tsconfig.json\` closely. They see \`"types": \["jest"\]\` - a leftover from trying to fix jest types earlier. The \`types\` array is a whitelist\! By explicitly listing only "jest", TypeScript is ignoring \`@types/node\` entirely. Developer adds "node" to the array: \`"types": \["node", "jest"\]\`. Errors immediately vanish. Developer understands that \`types\` in tsconfig is an explicit inclusion list, not a "load these extra" list; omitting it loads all \`@types\` packages, but specifying it restricts to only those listed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:19:18.764416+00:00— report_created — created