镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Closed

Description

@ankalagon17

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Did this behavior use to work in the previous version?
Yes, the previous version in which this bug was not present was: 7.9.3

Description

I have this problem when I execute the command "ng serve". The output says that I need a very specific version of TypeScript, the thing is that I already have that version.

🔬 Minimal Reproduction

This is my file "package.json"
{
"name": "client",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.1.2",
"@angular/cdk": "^8.1.1",
"@angular/common": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/material": "^8.1.1",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"angular-in-memory-web-api": "^0.8.0",
"bootstrap": "^4.3.1",
"core-js": "^3.1.4",
"hammerjs": "^2.0.8",
"jquery": "^3.4.1",
"path": "^0.12.7",
"popper.js": "^1.14.7",
"rxjs": "~6.5.2",
"tslib": "^1.10.0",
"webpack": "^4.36.1",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.801.2",
"@angular/cli": "~8.1.2",
"@angular/compiler-cli": "~8.1.2",
"@angular/language-service": "~8.1.2",
"@types/jasmine": "^3.3.13",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.6.8",
"angular-in-memory-web-api": "^0.8.0",
"codelyzer": "^5.0.1",
"jasmine-core": "^3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.2.0",
"karma-chrome-launcher": "^3.0.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.0",
"ts-node": "^8.3.0",
"tslint": "^5.18.0",
"typescript": "^3.4.5"
}
}

The command I executed is this:
ng serve

This is the output:
10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html
chunk {main} main.js, main.js.map (main) 2.05 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 122 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.09 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 163 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.91 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 338 kB [initial] [rendered]
Date: 2019-07-20T19:19:29.175Z - Hash: af8f78b3ee151ad64244 - Time: 8479ms

ERROR in The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead.
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.

My global TypeScript version:
tsc --version
Version 3.4.5

🔥 Exception or Error

ERROR in The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead.
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.

🌍 Your Environment




My Angular & Node Version:
Angular CLI: 8.1.2
Node: 10.16.0
OS: win32 x64
Angular: 8.1.2
... animations, cli, 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/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.36.1


Activity

  1. nenadbulatovic commented on Jul 20, 2019

    @nenadbulatovic

    I confirm. I have exact same error.

    ERROR in The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead. ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** i 「wdm」: Failed to compile.

  2. alan-agius4 commented on Jul 21, 2019

    @alan-agius4
    Collaborator

    Hi, TypeScript version should be ~3.4.5 instead of ^3.4.5.

    As the latter will match and install minor versions, in the case 3.5.3 which are not supported by the Angular Compiler CLI.

  3. ankalagon17 commented on Jul 22, 2019

    @ankalagon17
    Author

    Thank you very much for responding so soon, I already made the changes and it worked correctly.

    Greetings and thanks.

  4. HaydnNeese commented on Jul 23, 2019

    @HaydnNeese

    Just a side note in case anyone read this and makes a rookie mistake like myself.
    After changing ^3.4.5 to ~3.4.5 make sure to do npm install again, to save yourself from feeling dumb after.

  5. vtolstov commented on Jul 25, 2019

    @vtolstov

    how to deal if i need typescript > 3.5.0 ?

  6. TylerRick commented on Jul 31, 2019

    @TylerRick

    Other packages are starting to depend on things like Omit from TypeScript 3.5. Could this be updated to support 3.5 please?

  7. clydin commented on Jul 31, 2019

    @clydin
    Member

    Version 8.2 (currently in RC) provides support for TypeScript 3.5

  8. TylerRick commented on Jul 31, 2019

    @TylerRick

    Thanks! Looks like it's able to compile now after locking packages to 8.2.0-rc.0.

  9. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions