itsource

리포지토리가 깨끗하지 않습니다.Angular 8에서 업데이트하기 전에 변경 사항을 커밋하거나 저장하십시오.

mycopycode 2023. 3. 18. 08:38
반응형

리포지토리가 깨끗하지 않습니다.Angular 8에서 업데이트하기 전에 변경 사항을 커밋하거나 저장하십시오.

에러

리포지토리가 깨끗하지 않습니다.업데이트하기 전에 변경 내용을 커밋하거나 저장하십시오.

버전 7에서 Angular 8로 업데이트 했을 때.

업그레이드 각도 가이드 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 

구글 검색 후 앵글8 이후 이런 일이 벌어집니다.

버그

https://github.com/angular/angular-cli/issues/14600

Angular 8의 버그입니다.

다음을 사용하여 문제를 해결할 수 있습니다.

ng update @angular/cli @angular/core --allow-dirty

angular 8에서 angular 9로 업그레이드하기 위해 멘션 명령어를 사용해보았지만 여전히 오류가 발생하고 있습니다.

그런 다음 --force flag를 사용하여 동일한 명령을 시도했는데 효과가 있었습니다.

ng update @angular/cli @angular/core --allow-dirty --force

저도 같은 문제가 있었어요.Angular 8에서 흔히 볼 수 있는 벌레입니다.dirty 명령어를 사용하여 repo 체크를 바이패스할 수 있습니다(이것을 바이패스할 필요가 있는 경우는 force 명령어를 따릅니다).

ng update @angular/cli @angular/core --allow-dirty or
ng update @angular/cli @angular/core --allow-dirty --force

하지만 난 그러지 않았어나는 다음 단계를 따랐다...

우선 업데이트 전에 모든 변경을 커밋했는지 다시 한 번 확인합니다.그런 다음 프로젝트의 복사본을 같은 위치에 보관하고 Git에도 복사본을 커밋합니다. 그런 다음 원래 프로젝트 디렉토리에서 다음 명령을 실행합니다.

ng update @angular/core@8 @angular/cli@8

나중에 복사본을 삭제할 수 있습니다.잘 먹혔어! 고마워!

나에게 효과가 있었다

sudo npm update @angular/cli @angular/core --allow-dirty --legacy-peer-deps

Angular 13 프로젝트를 Angular 14(2022년 10월)로 업그레이드하는 데 도움이 되었습니다.

프로젝트 디렉터리에서 관리자 권한으로 명령 프롬프트를 여십시오.그런 다음 다음 명령을 실행합니다.

ng update @angular/core@14 @angular/cli@14 --allow-dirty --force

다음과 같은 출력이 표시됩니다(기존 Angular 버전에 따라 다를 수 있습니다).

The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 14.2.5 to perform the update.
√ Package successfully installed.
Repository is not clean. Update changes will be mixed with pre-existing changes.
Using package manager: npm
Collecting installed dependencies...
Found 23 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular-devkit/build-angular @ "14.2.5" (was "13.2.6")...
    Updating package.json with dependency @angular/cli @ "14.2.5" (was "13.2.6")...
    Updating package.json with dependency @angular/compiler-cli @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency typescript @ "4.8.4" (was "4.5.5")...
    Updating package.json with dependency @angular/animations @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency @angular/common @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency @angular/compiler @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency @angular/core @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency @angular/forms @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency @angular/platform-browser @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "14.2.5" (was "13.2.7")...
    Updating package.json with dependency @angular/router @ "14.2.5" (was "13.2.7")...
UPDATE package.json (1068 bytes)
√ Packages successfully installed.
** Executing migrations of package '@angular/cli' **

> Remove 'defaultProject' option from workspace configuration.
  The project to use will be determined from the current working directory.
UPDATE angular.json (3177 bytes)
  Migration completed.

> Remove 'showCircularDependencies' option from browser and server builders.
  Migration completed.

> Replace 'defaultCollection' option in workspace configuration with 'schematicCollections'.
  Migration completed.

> Update Angular packages 'dependencies' and 'devDependencies' version prefix to '^' instead of '~'.
UPDATE package.json (1068 bytes)
√ Packages installed successfully.
  Migration completed.

> Remove 'package.json' files from library projects secondary entrypoints.
  Migration completed.

> Update TypeScript compilation target to 'ES2020'.
UPDATE tsconfig.json (863 bytes)
  Migration completed.

** Executing migrations of package '@angular/core' **

> As of Angular version 13, `entryComponents` are no longer necessary.
  Migration completed.

> In Angular version 14, the `pathMatch` property of `Routes` was updated to be a strict union of the two valid options: `'full'|'prefix'`.
  `Routes` and `Route` variables need an explicit type so TypeScript does not infer the property as the looser `string`.
  Migration completed.

> As of Angular version 14, Forms model classes accept a type parameter, and existing usages must be opted out to preserve backwards-compatibility.
  Migration completed.

다음은 저의 업데이트된 패키지입니다.업그레이드 후 json 파일:

{
  "name": "custom-project-14",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.2.5",
    "@angular/common": "^14.2.5",
    "@angular/compiler": "^14.2.5",
    "@angular/core": "^14.2.5",
    "@angular/forms": "^14.2.5",
    "@angular/platform-browser": "^14.2.5",
    "@angular/platform-browser-dynamic": "^14.2.5",
    "@angular/router": "^14.2.5",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.5",
    "@angular/cli": "^14.2.5",
    "@angular/compiler-cli": "^14.2.5",
    "@types/jasmine": "~3.10.0",
    "@types/node": "^12.11.1",
    "jasmine-core": "~4.0.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.1.0",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "typescript": "~4.8.4"
  }
}

제 경우 node_module 폴더가 .moduleignore에서 제외되지 않았기 때문입니다.추가 후 이 에러는 발생하지 않게 되었습니다.

먼저, yes push이면 git에 푸시하지 않은 코드에 변경이 있는지 확인하고, 이전 인스턴스(cmd)를 닫고 cmd의 새 인스턴스를 연 후 명령을 실행합니다.잘 먹혔어, 고마워

많은 경우 나타날 수 있습니다.변경 내용을 커밋 또는 저장하여 명령을 다시 실행합니다.

언급URL : https://stackoverflow.com/questions/56773528/repository-is-not-clean-please-commit-or-stash-any-changes-before-updating-in-a

반응형