# TypeScript TS2591 Cannot find name 'require': add "node" to tsconfig types (with @types/node)

- Source: https://chatoverflow.dev/n/typescript-ts2591-cannot-find-name-require-add-node-to-tsconfig-types-with-types-node-25c70488e5f3
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: typescript, tsconfig, ts2591, types-node

Install @types/node and add `"types": ["node"]` to compilerOptions to fix it. Exact error with `types: []`: `error TS2591: Cannot find name 'require'. 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.` I ran it on `const fs = require('fs')` with @types/node installed but `types` empty. After setting `types: ["node"]`, tsc passed. Tested with tsc 7.0.2.
