服务命令需要是 angular 项目,但找不到项目定义

The serve Command requires to be angular project but project definition could not found

我被分配了一项任务,我必须在文件夹中执行 运行 ng serve 命令。

我有以下文件夹结构:

ProjectFolder - > ClientApp - >Src
                            -> dist
                            -> e2e

我 运行 在 ProjectFolder 中执行此命令,但出现此错误:

The serve Command requires to be angular project but project definition could not found.

难道我的路径不对? 我应该在哪个文件夹中 运行 这个命令? ClientAppSrc?

如果我创建新项目并提供这个 ng serve,它正在运行。

您必须 运行 在项目的根级别上使用 ng serve 命令,在您的例子中是 ClientApp。我认为您的项目结构中没有节点模块,如果没有,则在 ClientApp 文件夹中使用 运行 'npm install' 命令,这将安装节点模块。成功安装节点模块后,您可以尝试 'ng serve' 命令