Skip to content

NormalGaussian/yarn-typescript-version-types-check

Repository files navigation

Repro: TypeScript 6.0 fails to resolve @types/node under Yarn PnP

Minimal reproduction for a bug report.

Setup

  • Yarn 4.17.0, nodeLinker: pnp (the default).
  • Two workspaces under packages/ with byte-for-byte identical tsconfig.json and src/index.ts:
    • pkg-5-9-3 — depends on typescript@5.9.3
    • pkg-6-0-3 — depends on typescript@6.0.3
  • Both depend on @types/node@*, and both resolve to the same @types/node@26.0.0 PnP zip.

The only difference between the two workspaces is the TypeScript version.

Reproduce

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.json

Observed

pkg-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.json

Expected

pkg-6-0-3 should also compile cleanly, finding @types/node exactly as pkg-5-9-3 does.

Note

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors