Answer a question

Updating angular 7 to angular 8, I updated successfully upto angular/cli angular/core using the command $ ng update @angular/cli@v8 @angular/core@v8. And i used angular material also, so i want to update material then i update with $ ng update @angular/material@v8. But after running the command i got Repository is not clean. Please commit or stash any changes before updating.

So I committed before changes to git, then again I tried with the same command, then also getting the same message. Now there are no files to commit or stash.

This is the dependencies of the package.json files: "dependencies": { "@angular/animations": "^8.0.0", "@angular/cdk": "^7.3.7", "@angular/common": "^8.0.0", "@angular/compiler": "^8.0.0", "@angular/core": "^8.0.0", "@angular/forms": "^8.0.0", "@angular/material": "^7.3.7", "@angular/platform-browser": "^8.0.0", "@angular/platform-browser-dynamic": "^8.0.0", "@angular/router": "^8.0.0", "core-js": "^2.5.4", "hammerjs": "^2.0.8", "ngx-loading": "^3.0.1", "rxjs": "6.5.2", "underscore": "^1.9.1", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.800.0", "@angular/cli": "~8.0.2", "@angular/compiler-cli": "^8.0.0", "@angular/language-service": "^8.0.0", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "bootstrap-sass": "^3.3.7", "codelyzer": "^5.0.1", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~1.7.1", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.0", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "karma-scss-preprocessor": "^3.0.0", "protractor": "~5.3.0", "ts-node": "~5.0.1", "tslint": "~5.9.1", "typescript": "~3.4.5" }

This is the message i got: D:\test>ng update @angular/material@v8 Repository is not clean. Please commit or stash any changes before updating.

I delete the node_modules folder and reinstalled with the help of $ npm install --save. After installed i tried again, then also getting the same message.

Does anyone know, how to update the material?

Answers

You mentioned that you have untracked files. These are causing the check to fail (a git repository with untracked files is considered unclean). More about this here.

You can see how the ng tool runs this check here: https://github.com/angular/angular-cli/blob/3d25d4cb/packages/angular/cli/commands/update-impl.ts#L351

You can stash these files with:

git stash save --include-untracked

And unstash them after running the update with:

git stash pop

Your other options are to delete the files or add them to your .gitignore.

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐