afe*_*eef 20 git typescript angular angular8
错误
储存库不干净。请先提交或存储任何更改,然后再进行更新
当我从版本7更新到Angular 8时。
Angular升级指南https://update.angular.io/#7.0:8.0
D:\app-test> ng update @angular/cli @angular/core
npm cache verify
Run Code Online (Sandbox Code Playgroud)
储存库不干净。请在更新之前提交或存储任何更改。
更新版本
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.
Run Code Online (Sandbox Code Playgroud)
我检查了git没有安装在项目中。
有效的解决方案
git commit
Run Code Online (Sandbox Code Playgroud)
在谷歌搜索后,我正在Angular 8之后发生这种情况。
虫子
sha*_*ain 55
I have tried using mention command for upgrading from angular 8 to angular 9, but was still getting the error.
Then i have tried same command with --force flag and it worked for me.
ng update @angular/cli @angular/core --allow-dirty --force
Run Code Online (Sandbox Code Playgroud)
MrM*_*ith 37
我有同样的问题。这是 Angular 8 中的一个常见错误。您可以使用脏命令绕过 repo 检查,例如(如果您确实需要绕过这个,请遵循强制命令)
ng update @angular/cli @angular/core --allow-dirty or
ng update @angular/cli @angular/core --allow-dirty --force
Run Code Online (Sandbox Code Playgroud)
但是,我没有那样做。我按照以下步骤...
首先仔细检查您是否在更新之前提交了所有更改。然后将项目的副本保留到同一位置并将副本也提交到 Git。然后从原始项目目录运行以下命令
ng update @angular/core@8 @angular/cli@8
Run Code Online (Sandbox Code Playgroud)
之后你可以删除副本。这对我有用!谢谢你!
Abd*_*eeb 36
这是Angular 8中的错误
您可以使用以下方法解决此问题:
ng update @angular/cli @angular/core --allow-dirty
Jon*_* C. 12
为我工作
sudo npm update @angular/cli @angular/core --allow-dirty --legacy-peer-deps
Run Code Online (Sandbox Code Playgroud)
以下内容帮助我将 Angular 13 项目升级到 Angular 14(2022 年 10 月):
\n在项目目录中,使用管理员权限打开命令提示符。然后运行以下命令:
\nng update @angular/core@14 @angular/cli@14 --allow-dirty --force
这应该显示类似于以下内容的输出(可能会根据您现有的 Angular 版本而有所不同):
\nThe installed Angular CLI version is outdated.\nInstalling a temporary Angular CLI versioned 14.2.5 to perform the update.\n\xe2\x88\x9a Package successfully installed.\nRepository is not clean. Update changes will be mixed with pre-existing changes.\nUsing package manager: npm\nCollecting installed dependencies...\nFound 23 dependencies.\nFetching dependency metadata from registry...\n Updating package.json with dependency @angular-devkit/build-angular @ "14.2.5" (was "13.2.6")...\n Updating package.json with dependency @angular/cli @ "14.2.5" (was "13.2.6")...\n Updating package.json with dependency @angular/compiler-cli @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency typescript @ "4.8.4" (was "4.5.5")...\n Updating package.json with dependency @angular/animations @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency @angular/common @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency @angular/compiler @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency @angular/core @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency @angular/forms @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency @angular/platform-browser @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency @angular/platform-browser-dynamic @ "14.2.5" (was "13.2.7")...\n Updating package.json with dependency @angular/router @ "14.2.5" (was "13.2.7")...\nUPDATE package.json (1068 bytes)\n\xe2\x88\x9a Packages successfully installed.\n** Executing migrations of package '@angular/cli' **\n\n> Remove 'defaultProject' option from workspace configuration.\n The project to use will be determined from the current working directory.\nUPDATE angular.json (3177 bytes)\n Migration completed.\n\n> Remove 'showCircularDependencies' option from browser and server builders.\n Migration completed.\n\n> Replace 'defaultCollection' option in workspace configuration with 'schematicCollections'.\n Migration completed.\n\n> Update Angular packages 'dependencies' and 'devDependencies' version prefix to '^' instead of '~'.\nUPDATE package.json (1068 bytes)\n\xe2\x88\x9a Packages installed successfully.\n Migration completed.\n\n> Remove 'package.json' files from library projects secondary entrypoints.\n Migration completed.\n\n> Update TypeScript compilation target to 'ES2020'.\nUPDATE tsconfig.json (863 bytes)\n Migration completed.\n\n** Executing migrations of package '@angular/core' **\n\n> As of Angular version 13, `entryComponents` are no longer necessary.\n Migration completed.\n\n> In Angular version 14, the `pathMatch` property of `Routes` was updated to be a strict union of the two valid options: `'full'|'prefix'`.\n `Routes` and `Route` variables need an explicit type so TypeScript does not infer the property as the looser `string`.\n Migration completed.\n\n> As of Angular version 14, Forms model classes accept a type parameter, and existing usages must be opted out to preserve backwards-compatibility.\n Migration completed.\nRun Code Online (Sandbox Code Playgroud)\n以下是升级后我更新的 package.json 文件:
\n{\n "name": "custom-project-14",\n "version": "0.0.0",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "watch": "ng build --watch --configuration development",\n "test": "ng test"\n },\n "private": true,\n "dependencies": {\n "@angular/animations": "^14.2.5",\n "@angular/common": "^14.2.5",\n "@angular/compiler": "^14.2.5",\n "@angular/core": "^14.2.5",\n "@angular/forms": "^14.2.5",\n "@angular/platform-browser": "^14.2.5",\n "@angular/platform-browser-dynamic": "^14.2.5",\n "@angular/router": "^14.2.5",\n "rxjs": "~7.5.0",\n "tslib": "^2.3.0",\n "zone.js": "~0.11.4"\n },\n "devDependencies": {\n "@angular-devkit/build-angular": "^14.2.5",\n "@angular/cli": "^14.2.5",\n "@angular/compiler-cli": "^14.2.5",\n "@types/jasmine": "~3.10.0",\n "@types/node": "^12.11.1",\n "jasmine-core": "~4.0.0",\n "karma": "~6.3.0",\n "karma-chrome-launcher": "~3.1.0",\n "karma-coverage": "~2.1.0",\n "karma-jasmine": "~4.0.0",\n "karma-jasmine-html-reporter": "~1.7.0",\n "typescript": "~4.8.4"\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
12753 次 |
| 最近记录: |