ERROR in TypeError: Cannot read property 'flags' of undefined

后端 未结 4 1744
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 22:29

I have a problem when I try to run ng serve on a recently created Angular project. The version I\'m using is 9.1.4, this error does not occur on a project with

相关标签:
4条回答
  • 2020-12-02 22:50

    9.1.6 just released, should fix that issue

    0 讨论(0)
  • 2020-12-02 23:04

    edit

    If you use angular 9.1.6 it should be fine now

    npm update @angular/cli @angular/core
    

    original post

    Something is broken in Angular 9.1.5 - if you run the following it should work:

    npm install @angular/core@9.1.4 @angular/animations@9.1.4 @angular/common@9.1.4 @angular/forms@9.1.4 @angular/platform-browser@9.1.4 @angular/router@9.1.4 @angular/platform-browser-dynamic@9.1.4 @angular/compiler@9.1.4 @angular/compiler-cli@9.1.4 @angular/language-service@9.1.4
    
    ng build
    

    Just spent about 4-5 hours trying to fix it myself...

    The issue seems to stem from using Angular CLI 9.1.4 with Angular 9.1.5 (most likely the compiler

    You'll see the issue when you do

    ng --version
    

    if you get:

    Angular CLI: 9.1.4
    Node: 12.16.3
    OS: win32 x64
    
    Angular: 9.1.5
    ... animations, cli, common, compiler, compiler-cli, core, forms
    ... language-service, platform-browser, platform-browser-dynamic
    ... router
    Ivy Workspace: Yes
    

    Then you will need to follow the npm installs i listed above

    0 讨论(0)
  • 2020-12-02 23:05

    @Matt's answer worked for me as well for ng serve, but needed additional steps. First do these steps "Quoting the steps from his answer":

    1. First check ng --version. Go to next step if you get:
    Angular CLI: 9.1.4
    Node: 12.16.3
    OS: win32 x64
    
    Angular: 9.1.5
    ... animations, cli, common, compiler, compiler-cli, core, forms
    ... language-service, platform-browser, platform-browser-dynamic
    ... router
    Ivy Workspace: Yes
    
    1. Force reinstall the angular packages with 9.1.4 as the version using:
    npm install @angular/core@9.1.4 @angular/animations@9.1.4 @angular/common@9.1.4 @angular/forms@9.1.4 @angular/platform-browser@9.1.4 @angular/router@9.1.4 @angular/platform-browser-dynamic@9.1.4 @angular/compiler@9.1.4 @angular/compiler-cli@9.1.4 @angular/language-service@9.1.4
    

    Couple of more steps for more ng serve to finally work.

    1. Next error I got was about tslib: An unhandled exception occurred: Cannot find module 'tslib' For this I installed the tslib package manually using npm.
    2. Next error I got was You seem to not be depending on "@angular/core" and/or "rxjs". This is an error.. For this I referred "You seem to not be depending on "@angular/core"." and voila! ng serve worked!
    0 讨论(0)
  • 2020-12-02 23:10

    try this solution :

    npm install @angular/core@9.1.4 @angular/animations@9.1.4 @angular/common@9.1.4 @angular/forms@9.1.4 @angular/platform-browser@9.1.4 @angular/router@9.1.4 @angular/platform-browser-dynamic@9.1.4 @angular/compiler@9.1.4 @angular/compiler-cli@9.1.4 @angular/language-service@9.1.4
    
    npm install
    
    ng serve
    
    0 讨论(0)
提交回复
热议问题