Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Angular Compiler requires TypeScript >=2.7.2 and <2.10.0 but 3.0.1 was found instead. #11876

Closed
DmitriyIvanko opened this issue Aug 13, 2018 · 19 comments

Comments

@DmitriyIvanko
Copy link

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[+] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

@angular/compiler-cli@6.1.2 requires typescript@'>=2.7.2 <2.10' but 3.0.1 was found instead.
Using this version can result in undefined behavior and difficult to debug problems.

Expected behavior

The compiler cli should use a newer version of typescript.

Minimal reproduction of the problem with instructions

Run
ng new MyProject
cd MyProject
npm i --save-dev typescript@latest
ng serve --open

What is the motivation/use case for changing the behavior?

The tools should use the current stable versions of other tools and not be making one or more steps back.

Environment

"@angular/cli": "~6.1.3",
"@angular/compiler-cli": "^6.1.2",
"@angular/language-service": "^6.1.2",
"@ngrx/schematics": "^6.1.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.5.8",
"codelyzer": "~4.4.3",
"jasmine-core": "~3.2.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^1.2.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.1",
"tslint": "~5.11.0",
"tslint-eslint-rules": "^5.3.1",
"typescript": "~3.0.1"

Angular version: 6.1.2


Browser:
 Build problem
 
For Tooling issues:
- Node version: 8.11.2  
- Platform:  Win 10 (x64) 
@petarnikolovski
Copy link

Similar happens if ng update @angular/cli is used. Typescript is updated to latest version (3.0.1) but the updater process will complain that typescript as a peer dependency should be lower version.

@trollkotze
Copy link

It's a "feature", not a bug. WTF: #11138 (comment)

@petarnikolovski
Copy link

@trollkotze Why would ng update upgrade typescript to the latest version, if the cli/compiler itself is not yet compatible with it? Seems so odd...

@trollkotze
Copy link

Yes that's what I meant to convey. It's weird.
Anyway, simply downgrading to typescript 2.9 again after that silly update solves it for now.

@alexeagle
Copy link
Contributor

@angular/compiler-cli support for TypeScript 3 will land in Angular 7

@umdstu
Copy link

umdstu commented Oct 18, 2018

Downgrading to typescript 2.9.2 (npm install typescript@2.9.2) and re-running ng update --all still yields the error (twice):
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.10", would install "3.1.3"

Verified that version 2.9.2 of typescript was in node_modules.

@emircanok
Copy link

Hello,
I solve this problem like this.
npm install typescript@">=2.7.2 <2.10.0"
Unfortunately, you must run this command after each npm update.

@carkod
Copy link

carkod commented Dec 21, 2018

After update to Angular 7 (check your angular version with ng --version), I was still getting the error. What solved it for me after update, add the following line to your tsconfig.json:
"angularCompilerOptions": { "enableIvy": true }

@eBitzu
Copy link

eBitzu commented Jan 7, 2019

After update to Angular 7 (check your angular version with ng --version), I was still getting the error. What solved it for me after update, add the following line to your tsconfig.json:
"angularCompilerOptions": { "enableIvy": true }

That's some trolling comment you just added right?

@latimeks
Copy link

I was lead here as I worked through trying to get Angular to work locally. What worked for me was @emircanok 's solution of running npm install typescript@">=2.7.2 <2.10.0" but I ran mine with a --save flag.

My build works now. My version is the following:
Angular CLI: 7.3.1
Node: 8.11.1
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 7.3.1
@angular/cli 7.3.1
@ngtools/webpack 6.0.8
@schematics/angular 7.3.1
@schematics/update 0.13.1
rxjs 6.0.0
typescript 2.9.2
webpack 4.8.3

@sotiris-rafail
Copy link

Is there a way to avoid downgrade?
I get ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.3.0 but 3.4.5 was found instead.

@prahaladbelavadi
Copy link

@sotiris-rafail
There might be ways to isolate scopes: https://stackoverflow.com/questions/53578372/error-in-the-angular-compiler-requires-typescript-3-1-1-and-3-2-0-but-3-2-1-w

Using @emircanok 's version:
npm install typescript@" >=3.1.1 and <3.3.0" should work too

@rfcdejong
Copy link

Same problem from Angular 7 to Angular 8, running ng update @angular/cli @angular/core

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

Seems this fixed that specific build error:

npm install typescript@">=3.4.0 <3.5.0"

@ucavalcante
Copy link

After update to Angular 7 (check your angular version with ng --version), I was still getting the error. What solved it for me after update, add the following line to your tsconfig.json:
"angularCompilerOptions": { "enableIvy": true }

This is work for me too.

@snahmad
Copy link

snahmad commented Jul 11, 2019

I got same issue
Update Angular 6 to Angular 8, running ng update @angular/cli @angular/core
ERROR in The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.2 was found instead.
then I tried

npm install typescript@">=3.4.0 <3.5.2"

still same error.

when I run ng build --prod

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

Any idea?

@ashenwgt
Copy link

npm install typescript@">=3.4.0 <3.5.0" --save-dev --save-exact worked for me perfectly just now.

@snahmad
Copy link

snahmad commented Jul 12, 2019

sure.
npm install typescript@">=3.4.0 <3.5.0" --save-dev --save-exact works for me as well.

Still get

ERROR in The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.1 was found instead.
When I do build.

ng build --prod

My ng version is:

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

Package Version

@angular-devkit/architect 0.800.3
@angular-devkit/build-angular 0.800.3
@angular-devkit/build-optimizer 0.800.3
@angular-devkit/build-webpack 0.800.3
@angular-devkit/core 8.0.3
@angular-devkit/schematics 8.1.1
@angular/cdk 8.0.1
@angular/cli 8.1.1
@angular/flex-layout 8.0.0-beta.26
@angular/http 7.2.15
@angular/material 8.0.1
@ngtools/webpack 8.0.3
@schematics/angular 8.1.1
@schematics/update 0.801.1
rxjs 6.5.2
typescript 3.4.5
webpack 4.30.0

@snahmad
Copy link

snahmad commented Jul 15, 2019

any idea?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests