简体   繁体   English

初始化 angular 项目失败

[英]Initializing angular project fails

I am trying to set up angular project from scratch.我正在尝试从头开始设置 angular 项目。

Below are the steps followed以下是遵循的步骤

  • Installed Node js安装的节点js
  • Installed Angular CLI using npm install -g @angular/cli@latest使用 npm install -g @angular/cli@latest 安装 Angular CLI

    Versions Angular CLI: 9.1.4 Node: 12.16.3 OS: win32 x64版本 Angular CLI:9.1.4 节点:12.16.3 操作系统:win32 x64

    Angular: ... Ivy Workspace: Angular:...常春藤工作区:

    Package Version Package版本

    @angular-devkit/architect 0.901.4 @angular-devkit/core 9.1.4 @angular-devkit/schematics 9.1.4 @schematics/angular 9.1.4 @schematics/update 0.901.4 rxjs 6.5.4 @angular-devkit/architect 0.901.4 @angular-devkit/core 9.1.4 @angular-devkit/schematics 9.1.4 @schematics/angular 9.1.4 @schematics/update 0.901.4 rxjs 6.5.4

Created a new app using ng new app_name使用 ng new app_name 创建了一个新应用
While trying to run the app through command ng serve I am getting a host of errors and app is not starting up在尝试通过命令 ng serve 运行应用程序时,我遇到了许多错误并且应用程序没有启动

Have attached screen shot of the error附上错误的屏幕截图在此处输入图像描述

edit编辑

If you use angular 9.1.6 it should be fine now如果您使用 angular 9.1.6 现在应该没问题

npm update @angular/cli @angular/core

original post原帖

I had the same problem after making a fresh project using使用创建新项目后我遇到了同样的问题

npm install -g @angular/cli
ng new <projectname>

I believe its a bug in 9.1.5 Angular when using the 9.1.4 cli我相信在使用 9.1.4 cli 时,它是 9.1.5 Angular 中的一个错误

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

To resolve you install 9.1.4 Angular instead by running after you've done your要解决您安装 9.1.4 Angular 的问题,请在完成后运行

ng new <projectname> 

then run然后运行

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

See my other answer for reference请参阅我的其他答案以供参考

ERROR in TypeError: Cannot read property 'flags' of undefined TypeError 中的错误:无法读取未定义的属性“标志”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM