1. Make sure you have upgraded node js to the LTS version and then follow the below.
2. Go to your project folder and open the terminal and run the below commands:
>npm uninstall --save-dev angular/cli
>npm i -g npm-check-updates
>ncu -u
ERROR (if the below error occurs follow the below link to fix in node js config):
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead
>npm install
>npm uninstall @angular-devkit/build-angular
>npm install --save-dev @angular-devkit/build-angular
>npm install --save --legacy-peer-deps