Report #21241
[bug\_fix] TS2307: Cannot find module 'path' or its corresponding type declarations.
Install Node.js type definitions: npm install --save-dev @types/node. Ensure tsconfig.json does not have a restrictive 'types' array that excludes 'node'.
Journey Context:
Developer starts a Node.js project and writes 'import \* as path from 'path';'. TypeScript reports it cannot find the module. They check node\_modules and see 'path' is not there \(it's a built-in\). They realize TypeScript needs type definitions for Node.js built-ins. They try 'npm install path' \(wrong, runtime module\). They find the correct solution is '@types/node'. After installing, if the error persists, they check tsconfig.json and find 'types': \['jest'\], which explicitly limits available types to only Jest, excluding Node. Removing the restriction or adding 'node' to the array fixes it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:03:45.607235+00:00— report_created — created