6

I'm trying to update my Angular with ng update --all as in this question stated [https://stackoverflow.com/questions/56419456/cant-find-compiler-ngcc-module-after-upgrading-angular-and-project], but it always says Repository is not clean. Please commit or stash any changes before updating.

I have run the following commands today:

npm install
npm install -g @angular/cli
npm install --save font-awesome angular-font-awesome
npm install angular-alert-module --save

At this state the program compiled

ng update @angular/cli

since then it does not compile

I read I need to do ng update --all --force but it doesn't work because the repository 'is not clean'.

I made a commit pushed it and pulled (where there were no changes) before. But it didn't help

ng update --all --force

The error-message is:

Repository is not clean.  Please commit or stash any changes before updating.
bakoyaro
  • 2,550
  • 3
  • 36
  • 63
T-Dog18
  • 119
  • 1
  • 1
  • 9
  • What is the output of `git status`? – Qortex Jun 10 '19 at 18:01
  • On branch detail-search Your branch is up to date with 'origin/detail-search'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: package-lock.json no changes added to commit (use "git add" and/or "git commit -a") – T-Dog18 Jun 10 '19 at 18:17
  • And sorry, I forgot to include: When I try to compile it comes: Cannot find module '@angular/compiler-cli/ngcc' Error: Cannot find module '@angular/compiler-cli/ngcc' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) ... – T-Dog18 Jun 10 '19 at 18:20
  • you need to `git add --all` and then `commit`. You have modified package-lock.json. – Qortex Jun 10 '19 at 18:29
  • Open a new question for your compile error, trying to pinpoint the faulty part. – Qortex Jun 10 '19 at 18:29
  • Thank you for your help.I write the issue in the answer – T-Dog18 Jun 10 '19 at 18:51

2 Answers2

8

You should use --allow-dirty if you want to bypass that warning.

This works on @angular/cli v8.0.1+.

ng update --all --allow-dirty
J J B
  • 8,540
  • 1
  • 28
  • 42
2

The issue was, that I commited all files (including the package-lock.json) it did mark it as modified. (I don't know why). Therefore the tree was not possible.

Because commiting was not possible (even though the error message suggests it), I had to stash it. Then it worked, but I had to stash after every command.

T-Dog18
  • 119
  • 1
  • 1
  • 9