错误
存储库不干净。请在更新前提交或隐藏任何更改
当我已经从版本7更新到Angular 8。
Angular Guide for upgrade https://update.angular.io/#7.0:8.0
D:\app-test> ng update @angular/cli @angular/core
npm cache verify
存储库不干净。请在更新前提交或隐藏任何更改。
更新版本
PS D:\app-test> ng update
Using package manager: 'npm'
Collecting installed dependencies...
Found 58 dependencies.
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
@angular/cdk 7.2.2 -> 8.0.1 ng update @angular/cdk
@angular/core 7.2.15 -> 8.0.1 ng update @angular/core
@angular/core 7.2.2 -> 7.2.15 ng update @angular/core
@angular/material 7.3.7 -> 8.0.1 ng update @angular/material
rxjs 6.3.3 -> 6.5.2 ng update rxjs
There might be additional packages that are outdated.
Run "ng update --all" to try to update all at the same time.
PS D:\app-test> ng update @angular/cdk
Repository is not clean. Please commit or stash any changes before updating.
我已经检查git没有安装在项目中。
有效的解决方案
git commit
谷歌搜索后,我有这是发生在Angular 8。
虫
https://github.com/angular/angular-cli/issues/14600
8条答案
按热度按时间ocebsuys1#
是Angular 8中的一个错误
您可以使用以下方法解决此问题:
第一个月
lo8azlld2#
我已经尝试使用提及命令从Angular 8升级到Angular 9,但仍然得到错误。
然后我尝试了相同的命令--强制标记,它对我很有效。
bqf10yzr3#
我也遇到过同样的问题。这是Angular 8中的一个常见错误。简单地说,你可以使用脏命令来绕过repo检查,比如(如果你真的需要绕过这个,请遵循强制命令)
但我没有那么做我按照以下步骤。
首先,在更新之前,仔细检查你是否提交了所有的更改。然后,在相同的位置保留一个项目的副本,并将副本提交到Git。然后,从原始项目目录运行以下命令
之后你可以删除副本。这对我很有效!谢谢!
ajsxfq5m4#
对我有用
ibrsph3r5#
以下内容有助于我将Angular 13项目升级为Angular 14(2022年10月):
在项目目录中,使用管理员权限打开命令提示符,然后运行以下命令:
第一个月
这将显示类似于以下内容的输出(根据您现有的Angular 版本可能有所不同):
以下是我在升级后更新的package.json文件:
7gyucuyw6#
在我的例子中,这是由于node_modules文件夹没有被. gitignore排除。一旦添加,这个错误不再出现
u91tlkcl7#
首先,检查你的代码中是否有任何更改还没有推送到git,如果是,推送它们,然后关闭旧示例(cmd)并打开一个新的cmd示例,然后运行命令。
ioekq8ef8#
在很多情况下都可能出现这种情况。只需提交或隐藏任何更改,然后再次运行该命令。