The Angular Compiler requires TypeScript >=6.0.0 and <6.1.0 but 7.0.2 was found instead.
Not confirmed yet · posted Nov 5
Cause
@angular/compiler-cli 22 checks the loaded ts.version against >=6.0.0 <6.1.0 when it creates the program; a 5.x TypeScript got in past its peer range, e.g. via --legacy-peer-deps.
Fix
risk: low
// package.json devDependencies: the range @angular/compiler-cli 22 peers on (>=6.0 <6.1)- "typescript": "~5.9.3",+ "typescript": "~6.0.3",// then a plain npm install; upgrading with ng update @angular/core @angular/cli bumps typescript tooDon’t try
npm i -D typescript@latest — latest is 7.x, the native port: its main export holds only the version, not the ts.* compiler API Angular calls, so ngc dies with ts2.parseCommandLine is not a function.
npm install --legacy-peer-deps (or --force) to get past the ERESOLVE on typescript — that is how the 5.x TypeScript got in: npm skips the peer check, then the compiler's own version check fails the build.
Related
- FormValueControl with transformedValue under [formControl] or [(ngModel)]: control.errors has the parse error but the control's
errors()input stays [] until an unrelated change detection - Error: PureFunctionConstant does not handle expressions of type VoidExpr
- NG6008: Component <Name> is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?