This version of CLI is only compatible with Angular versions ^11.0.0-next || >=11.0.0 <12.0.0, but Angular version 10.1.6 was found instead. code example

Example 1: This version of CLI is only compatible with Angular versions ^9.0.0-beta || >=9.0.0 <10.0.0, but Angular version 8.1.3 was found instead.

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@8.3.25

Example 2: This version of CLI is only compatible with Angular versions ^9.0.0-beta || >=9.0.0 <10.0.0, but Angular version 8.1.3 was found instead.

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