I had the same issue in Ionic 4 after running "npm audit fix", but npm broke the whole versioning of the dependencies.
I tried doing most of the things listed here but it would fix one problem and create a new one. So the only solution that worked for me was manual dependency handling.
Check out what versions of each package you need in your package.json and package-lock.json (which package version do other packages depend on and expect to find in your project, mine were expecting about three total versions of some files), some will be shown as warnings in your cli after npm installing some packages, but not all will show so do best to manually check.
NB: I found package-lock.json easier for me to read but I would refer to package.json to make sure I was still on the right track.
For me the main package was Ionic itself (@ionic/angular-toolkit was the only package I could find that was connected to angular), so I looked at the version of angular it was expecting and downgraded to that. Then every other package that angular needed also had to be checked. It was a lot of work and spent half a day fixing but it solved all my issues.
- An ionic package had this dependencies;
- @schematics/angular@^8.0.0
- tslib@^1.9.0
- ws@^7.0.1
Focusing on the angular package, I decided to
npm install @schematics/angular@8.0.0
That dependency, @schematics/angular@8.0.0, had the following dependencies;
- @angular-devkit/core@8.0.0
- @angular-devkit/schematics@8.0.0
The dependency, @angular-devkit/schematics@8.0.0 had the dependencies;
- @angular-devkit/core@8.0.0
- rxjs@6.4.0
I did this for all the packages until I could build my app again. But you can just install in one go if you know the versions they require
npm install @schematics/angular@8.0.0 @angular-devkit/core@8.0.0 @angular-devkit/schematics@8.0.0
You can put all the packages in that npm install line if you already know for certain which other packages should be downgraded or upgraded to save time.
Hope this helps anyone who couldn't find a solution from the other comments.