Minimal reproduction for a bug report.
- Yarn 4.17.0,
nodeLinker: pnp(the default). - Two workspaces under
packages/with byte-for-byte identicaltsconfig.jsonandsrc/index.ts:pkg-5-9-3— depends ontypescript@5.9.3pkg-6-0-3— depends ontypescript@6.0.3
- Both depend on
@types/node@*, and both resolve to the same@types/node@26.0.0PnP zip.
The only difference between the two workspaces is the TypeScript version.
yarn install
# Passes cleanly (exit 0)
yarn workspace pkg-5-9-3 tsc --project ./tsconfig.json
# Fails — cannot find @types/node (exit 2)
yarn workspace pkg-6-0-3 tsc --project ./tsconfig.jsonpkg-5-9-3 compiles with no errors.
pkg-6-0-3 fails:
src/index.ts(1,22): error TS2591: Cannot find name 'node:path'. 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.
src/index.ts(4,15): 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.
@types/node is installed and resolves to the identical zip from both workspaces:
yarn workspace pkg-5-9-3 node -e "console.log(require.resolve('@types/node/package.json'))"
yarn workspace pkg-6-0-3 node -e "console.log(require.resolve('@types/node/package.json'))"
# both -> .yarn/cache/@types-node-npm-26.0.0-...zip/node_modules/@types/node/package.jsonpkg-6-0-3 should also compile cleanly, finding @types/node exactly as pkg-5-9-3 does.
TypeScript 6.0 added a new diagnostic (TS5011) that requires rootDir to be set
explicitly; both tsconfig.json files set "rootDir": "./src" so that this unrelated
error does not mask the @types/node resolution failure being reported here.