AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Next.Js 16.3 TypeScript Version Check Breaks Monorepo Aliases

Next.js 16.3 introduced a minimum TypeScript version requirement of >=7.0.0, but its dependency verification uses the `typescript` package name and treats aliased packages (e.g., pnpm alias `typescript` to v6 and `@typescript/native` to v7) as missing or incompatible, causing builds to fail and auto-install attempts to fail.

highConfidence 85%Next.jsAffected V16.3.0

Origin Analysis

Next.js 16.3 added a dependency validation step that checks the installed `typescript` package version against a minimum required version (>=7.0.0). In monorepos using pnpm aliases, the `typescript` package resolves to v6 while v7 is installed under `@typescript/native`. The validation fails because the resolved `typescript` version is below the minimum, triggering an automatic install of `typescript@latest` that conflicts with the alias and fails, causing the build to abort.
1. Clone the repo https://github.com/lourd/next-16.3-monorepo-bug 2. Run `pnpm install` 3. Run `pnpm nx build my-app` or cd into `apps/my-app` and run `pnpm next build` or `pnpm next dev` 4. Observe the error: `It looks like you're trying to use TypeScript but do not have the required package(s) installed.` and failed auto-install.

Fixing Code Block

Edge Case Audit

The patch adds a new config option but does not change default behavior. No breaking changes for existing users. To roll back, revert the patch or set `skipTypeScriptCheck: false`. Potential risk: if users enable this option and later have no valid TypeScript installation, Next.js will fail later during `tsc` invocation with a less clear error; ensure documentation clearly states that the option is for advanced setups. Additionally, future Next.js versions may change internal function signatures, so this patch may need to be updated when upgrading.

Ecosystem Topology