【问题标题】:Running project with the Angular CLI throws an error使用 Angular CLI 运行项目会引发错误
【发布时间】:2020-05-19 06:20:12
【问题描述】:

当我通过 angular CLI 命令构建和运行 angular 7 应用程序时,它会生成以下错误消息:

serve 命令需要在 Angular 项目中运行,但是 找不到项目定义。

项目路径定义:E:\_EXTRA\IMPORTANT\Opps\Project>ng serve -o

创建成功安装的包后生成错误消息见下文。

√ Packages installed successfully.
'git' is not recognized as an internal or external command, operable program or batch file. 

【问题讨论】:

  • 我确定您运行 serve 命令的路径不正确

标签: angular angular-cli angular7


【解决方案1】:

您是否正确下载并安装了 git? https://git-scm.com/download/win 并正确设置您的 PATH 以指向您的 Git 安装? 您可能将 Git 安装在不同的驱动器上,或者安装在 Program Files (x86) 下。 检查:

where git

【讨论】:

    【解决方案2】:

    确保你已经安装了 git。

    git --version
    

    我也通过运行以下命令解决了这个问题:

    ng update @angular/cli --migrate-only --from=<YouCurrentCliVersion>
    

    例如

    ng update @angular/cli --migrate-only --from=8.1.2
    

    有时会发生,因为新的 angular-cli 尝试使用 angular.json 而不是 .angular-cli.json 作为项目文件。

    【讨论】:

      猜你喜欢
      • 2021-06-24
      • 2017-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-04
      • 2019-12-10
      • 2018-04-25
      相关资源
      最近更新 更多