TypeError中的错误:无法读取未定义的属性“标志”

耶稣亚伯拉多·拉米雷斯·赞布兰:

当我尝试ng serve在最近创建的Angular项目上运行时遇到问题我使用的版本是9.1.4,在具有较旧Angular版本的项目上不会发生此错误。

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.4
@angular-devkit/build-angular     0.901.4
@angular-devkit/build-optimizer   0.901.4
@angular-devkit/build-webpack     0.901.4
@angular-devkit/core              9.1.4
@angular-devkit/schematics        9.1.4
@angular/cli                      9.1.4
@ngtools/webpack                  9.1.4
@schematics/angular               9.1.4
@schematics/update                0.901.4
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

执行后ng serveng build

chunk {main} main.js, main.js.map (main) 2 kB [initial] [rendered]<br>
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 679 bytes [initial] [rendered]<br>
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]<br>
chunk {styles} styles.js, styles.js.map (styles) 12.4 kB [initial] [rendered]<br>
chunk {vendor} vendor.js, vendor.js.map (vendor) 339 kB [initial] [rendered]<br>
Date: 2020-05-08T02:06:46.145Z - Hash: 1a1b937f0ca2bb37634b - Time: 4087ms<br>

**ERROR in TypeError: Cannot read property 'flags' of undefined**
    at resolveAlias (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:36513:37)
    at checkAliasSymbol (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:64502:26)
    at checkImportBinding (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:64534:13)
    at checkImportDeclaration (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:64552:29)
    at checkSourceElementWorker (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:64961:28)
    at checkSourceElement (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:64800:17)
    at Object.forEach (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:317:30)
    at checkSourceFileWorker (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:65123:20)
    at checkSourceFile (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:65091:13)
    at getDiagnosticsWorker (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:65179:17)
    at Object.getDiagnostics (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:65165:24)
    at C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:98703:85
    at runWithCancellationToken (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:98665:24)
    at getBindAndCheckDiagnosticsForFileNoCache (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:98691:20)
    at getAndCacheDiagnostics (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:98956:26)
    at getBindAndCheckDiagnosticsForFile (C:\Cursos\Angular\ang-hello-world\node_modules\typescript\lib\typescript.js:98688:20)

** **Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/** **

运行该项目后,我在浏览器中得到的结果是:

Cannot GET /
马特:

编辑

如果您使用angular 9.1.6,现在应该没问题

npm update @angular/cli @angular/core

原始帖子

Angular 9.1.5中有问题-如果运行以下命令,它将可以正常工作:

npm install @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected]

ng build

自己花了大约4-5个小时来自行修复...

该问题似乎源于将Angular CLI 9.1.4与Angular 9.1.5一起使用(最有可能是编译器)

当您这样做时,您会看到问题

ng --version

如果你得到:

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

然后,您需要按照上面列出的步骤进行npm安装

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

错误TypeError:无法读取未定义的属性'length'

错误TypeError:无法读取未定义的属性'get'

错误TypeError:无法读取未定义的属性'nativeElement'

TypeError:无法读取未定义的属性“标志”

FormGroup错误TypeError:无法读取未定义的属性“ get”

错误TypeError:无法读取未定义的属性'ngInjectableDef'

错误TypeError:无法读取未定义的属性'firstName'

错误TypeError:无法读取未定义的属性“类别”

错误TypeError:无法读取未定义的属性“打开”

错误TypeError:无法读取未定义的属性'openDialogTEST'

呈现错误:“ TypeError:无法读取未定义的属性'text'”

作为错误:TypeError:无法读取未定义的属性“位置”

错误TypeError:无法读取未定义的属性'grower'

错误TypeError:无法读取未定义的属性'property'

错误TypeError:无法读取角度未定义的属性'closeRow'

错误TypeError:无法读取未定义的属性'formData'

角度-错误TypeError:无法读取未定义的属性'title'

错误TypeError:无法读取未定义的属性'Nom'

TypeError:无法读取未定义反应错误的属性“名称”

VSCode + Pytest:“错误:TypeError:无法读取未定义的属性” $“

错误TypeError:无法读取未定义的属性“匹配”

错误TypeError:无法读取未定义的属性“句柄”

错误TypeError:无法读取未定义的属性'__source'

Axios在React中未定义,错误:Uncaught TypeError:无法读取未定义的属性“ post”

错误TypeError:无法读取未定义的属性“调用”

nodejs 收到错误 TypeError:无法读取未定义的属性“then”

reactjs错误-TypeError:无法读取未定义的属性“地图”

反应 - 错误:TypeError:无法读取未定义的属性(读取“then”)

“TypeError:无法读取未定义的属性(读取'hasOwnProperty')”错误