angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open DmitriyIvanko opened this issue 8 years ago • 18 comments

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/[email protected] 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) 

                                    

DmitriyIvanko avatar Aug 13 '18 08:08 DmitriyIvanko

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.

petarnikolovski avatar Aug 13 '18 11:08 petarnikolovski

It's a "feature", not a bug. WTF: https://github.com/angular/angular-cli/issues/11138#issuecomment-395494996

trollkotze avatar Aug 13 '18 14:08 trollkotze

@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...

petarnikolovski avatar Aug 13 '18 14:08 petarnikolovski

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.

trollkotze avatar Aug 13 '18 16:08 trollkotze

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

alexeagle avatar Aug 13 '18 22:08 alexeagle

Downgrading to typescript 2.9.2 (npm install [email protected]) 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.

umdstu avatar Oct 18 '18 14:10 umdstu

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.

emircanok avatar Dec 01 '18 20:12 emircanok

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 }

carkod avatar Dec 21 '18 16:12 carkod

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?

eBitzu avatar Jan 07 '19 15:01 eBitzu

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

latimeks avatar Feb 11 '19 20:02 latimeks

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.

sotiris-rafail avatar May 17 '19 12:05 sotiris-rafail

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"

rfcdejong avatar Jun 06 '19 08:06 rfcdejong

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.

ucavalcante avatar Jun 18 '19 14:06 ucavalcante

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?

snahmad avatar Jul 11 '19 10:07 snahmad

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

ashenwgt avatar Jul 12 '19 06:07 ashenwgt

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 avatar Jul 12 '19 07:07 snahmad

any idea?

snahmad avatar Jul 15 '19 08:07 snahmad

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.