首页 > 解决方案 > 陷入角度 8 错误循环

问题描述

看来,我陷入了角度错误的无限循环。我将我的本地角度版本从 1.7.0 更新到角度 8。我的全局角度版本已经是 8。在将我的角度版本更新到 8 之后,我运行了以下命令

 ng serve 

我得到了错误说

"The serve command requires to be run in an Angular project, but a project definition could not be found"

谷歌搜索这个问题后,我在终端窗口中运行了这个命令

"ng update @angular/cli --migrate-only --from=1.7.0". 

运行此命令后,我收到此错误消息

`"Repository is not clean.  Please commit or stash any changes before updating.".`

为了修复错误,我运行了这个命令说

 ng update --all --force.

我再次收到错误消息

"Repository is not clean.  Please commit or stash any changes before updating" 

所以我运行了这个命令

ng update -all --force --allow-dirty. 

当我运行上述命令时,我收到了这条消息:

Repository is not clean.  Update changes will be mixed with pre-existing changes.
Using package manager: 'npm'
Collecting installed dependencies...
Found 35 dependencies.
Package '-l' is not a dependency.

在此之后,我又做了

ng serve 

我再次收到这个错误说

"The serve command requires to be run in an Angular project, but a project definition could not be found."

我愿意回到 Angular 版本 7,但不确定这是否会有所帮助。下面在此处输入图像描述是我在执行 ng--version 时看到的图像

在这方面的任何帮助将不胜感激。

标签: angularasp.net-core

解决方案


有一个命令允许绕过 git 状态检查。

ng update @angular/cli --allow-dirty

该更新正在检查未提交的文件并失败,因为如果更新继续进行而没有干净的状态,可能会给自己带来一些麻烦。即将到来的日期只会检查 Angular 文件。

否则,存储或提交您的工作并再次运行更新命令。


推荐阅读