I am not able to solve the problem that is caused by the wrong version of typescript. When I run ng serve
, I see this warning message:
@angular/compiler-cli@6.1.10 requires typescript@'>=2.7.0 <2.8.0' but 2.8.4 was found instead.
I tried many solutions and I failed to solve it. I want to continue working on my project until I find a solution. Would it be difficult to solve it later on? Would it cause other problems in my project?
Asked
Active
Viewed 31 times
-2

Tanaka
- 316
- 1
- 3
- 12
-
Just install the correct version of typescript. See [here](https://stackoverflow.com/questions/15890958/install-a-previous-version-of-a-package) or just edit your `package.json`. – Paul Rooney Oct 20 '19 at 09:15
-
Or better, avoid staying on an old version of Angular (and TypeScript), and upgrade to the latest version. – JB Nizet Oct 20 '19 at 09:17
-
I tried many solutions but I could not solve it. I tried many typescript versions but either it fails to compile or it compiles with that warning message. – Tanaka Oct 20 '19 at 09:19
-
@JBNizet , I am watching online course and I don't know If I can follow the instructor with a higher version. He uses angular/cli@6.0.8. – Tanaka Oct 20 '19 at 09:20
-
Possible duplicate of your own post 2 hours prior... ["How do I match typescript versions in my project as it shows error "requires typescript@>=2.7.0 <2.8.0"](https://stackoverflow.com/questions/58470703/how-do-i-match-typescript-versions-in-my-project-as-it-shows-error-requires-ty) – Zze Oct 20 '19 at 20:29
1 Answers
0
You can specify a version range for packages to install in order to satisfy the requirements of the warning message:
npm i typescript@">=2.7.0 <2.8.0"
However, one caveat to note that version ranges should be placed in quotes if there are spaces:
Note that most version ranges must be put in quotes so that your shell will treat it as a single argument. -
npm install
documentation
For more info about the install
command, check out the NPM documentation.
Alternatively, to avoid these kind of dependency issues, consider updating your app to use the latest version of Angular. See the Angular Update Guide for more info on how to upgrade and the Keep your Angular Projects Up-to-Date guide on more info about upgrading.

Edric
- 24,639
- 13
- 81
- 91