Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

580
Views
The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead

I'm getting the following error when I do npm run build:

The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead.

I've tried following things separately:

npm install typescript@">=3.4.0 <3.5.0". Then deleted node_modules and package.json. Run npm install

npm update --force. Then deleted node_modules and package.json. Run npm install

I'm still getting the error:

My package.json contains following dependencies:

  "dependencies": {
    "@angular/animations": "8.1.0",
    "@angular/cdk": "^8.0.2",
    "@angular/cli": "^8.1.0",
    "@angular/common": "8.1.0",
    "@angular/compiler": "8.1.0",
    "@angular/core": "8.1.0",
    "@angular/forms": "8.1.0",
    "@angular/http": "7.2.15",
    "@angular/material": "^8.0.2",
    "@angular/platform-browser": "8.1.0",
    "@angular/platform-browser-dynamic": "8.1.0",
    "@angular/router": "8.1.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "angular-user-idle": "^2.1.2",
    "angular2-cookie": "^1.2.6",
    "core-js": "^2.6.7",
    "rxjs": "6.5.2",
    "rxjs-tslint": "^0.1.5",
    "stream": "0.0.2",
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.801.0",
    "@angular/compiler-cli": "8.1.0",
    "@angular/language-service": "8.1.0",
    "@types/jasmine": "~3.3.13",
    "@types/jasminewd2": "~2.0.6",
    "@types/node": "~12.6.1",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "protractor": "~5.4.2",
    "ts-node": "~8.3.0",
    "tslint": "~5.18.0",
    "typescript": "^3.4.5"
  }

ng --version gives following output:

Angular CLI: 8.1.2
Node: 10.16.0
OS: win32 x64
Angular: 8.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.2
@angular-devkit/build-angular     0.801.2
@angular-devkit/build-optimizer   0.801.2
@angular-devkit/build-webpack     0.801.2
@angular-devkit/core              8.1.2
@angular-devkit/schematics        8.1.2
@angular/cdk                      8.1.1
@angular/cli                      8.1.2
@angular/http                     7.2.15
@angular/material                 8.1.1
@ngtools/webpack                  8.1.2
@schematics/angular               8.1.2
@schematics/update                0.801.2
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.35.2

What could be going wrong here?

over 4 years ago · Santiago Trujillo
15 answers
Answer question

0

You have two options:

1-automatically:

this will install the right version

npm install typescript@">=3.4.0 and <3.5.0" --save-dev

2-manually:

go to package.json and change your typescript version, If you want to upgrade your angular project to

Angular 13 (npm install typescript@"~4.4.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~4.4.0"
}

Angular 12 (npm install typescript@"~4.2.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~4.2.0"
}

Angular 11 (npm install typescript@"~4.0.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~4.0.0"
}

Angular 10 (npm install typescript@"~3.8.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~3.8.0"
}

Angular 9 (npm install typescript@"~3.7.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~3.7.0"
}

Angular 8 (npm install typescript@"~3.4.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~3.4.0"
}

Angular 7 (npm install typescript@"~3.1.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~3.1.0"
}

Angular 6 (npm install typescript@"~2.9.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~2.9.0"
}

Angular 4 (npm install typescript@"~2.2.0" --save-dev)

"devDependencies": {
  ...
  "typescript": "~2.2.0"
}

Then run:

npm install 
over 4 years ago · Santiago Trujillo Report

0

use this command its work for me.. Thanks

npm i typescript@">=3.6.4 <3.8.0"
over 4 years ago · Santiago Trujillo Report

0

If you want to upgrade your angular project to Angular 11

npm install typescript@">=4.0.0 and <4.2.0" --save-dev

In package.json :

"devDependencies": {
      ...
      "typescript": "^4.1.5"
 }
over 4 years ago · Santiago Trujillo Report

0

In my case I received this error when migrating from Angular 10 to Angular 11.

An unhandled exception occurred: The Angular Compiler requires TypeScript >=4.0.0 and <4.2.0 but 4. 2.3 was found instead.

To resolve this issue I used this code in Visual Studio where my Angular project exist:

npm install typescript@'>==4.0.0 <4.2.0'
over 4 years ago · Santiago Trujillo Report

0

When I had a similar error, I run:

yarn clean cache

If you use npm you can try to run:

npm clean cache

I'm not sure that is a 100% solution, but I hope it can help someone.

over 4 years ago · Santiago Trujillo Report

0

Instead of "typescript": "^3.4.5" under devDependencies in your package.json file enter "typescript": "~3.4.5" and save the file, then run npm install again. It worked for me.

over 4 years ago · Santiago Trujillo Report

0

Using Angular 11 use

npm i -D typescript@4.0.5
over 4 years ago · Santiago Trujillo Report

0

Please uninstall typescript by using the following command:

npm uninstall typescript

and then install typescript specific version:

npm i --save-dev typescript@3.4.5
over 4 years ago · Santiago Trujillo Report

0

This issue is mainly depended on @angular/cli version so typescript is depend on angular version

when you update angular check this website(devDependency)

https://david-dm.org/angular/angular-cli

and do

npm i --save-dev typescript@3.4.5

3.4.5version is required

over 4 years ago · Santiago Trujillo Report

0

Run this:

npm i --save-dev typescript@~3.4.5
over 4 years ago · Santiago Trujillo Report

0

Run this script to find exact version

npm install typescript@">=3.4.0 and <3.5.0" --save-dev
over 4 years ago · Santiago Trujillo Report

0

You don't need to uninstall and again install the typescript so you can install the specific version of typescript as recommended in the error.

npm install typescript@ version

or you can run

npm install typescript@ version --save-dev

to save it in the package json

over 4 years ago · Santiago Trujillo Report

0

I was getting this problem in my Angular 9 as well, but with different version numbers.

ERROR in The Angular Compiler requires TypeScript >=3.6.4 and <3.8.0 but 3.8.2 was found instead.

enter image description here

What I did was,

  1. Went to the Angular 9 breaking changes
  2. Searched for typescript version and found that it supports only 3.7
  3. Edit my typescript version in package.json as "typescript": "~3.7.0"
  4. ran npm i

The ~ here is important as it will make sure that it will update only to the next patch version (<3.8.0), not to the minor versions, if you use ^ it will update to minor versions too(for example, 4.0.0).

over 4 years ago · Santiago Trujillo Report

0

Your wrong is "^" "typescript": "^3.4.0" in your package.json

the solution is "typescript": "~3.4.0"

over 4 years ago · Santiago Trujillo Report

0

Good news!

You can use TypeScript 3.5 if you upgrade to Angular 8.2+. Version 8.1 didn't support it just yet.

Proof: https://github.com/angular/angular-cli/issues/15134#issuecomment-516908416

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!