could not find @angular-devkit/build-angular code example

Example 1: An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json' Require stack:

npm install --save-dev @angular-devkit/build-angular

Example 2: Could not find module "@angular-devkit/build-angular

ng update @angular/cli @angular/core

If you are updating from angular 7 to angular 8 then do this

ng update @angular/cli @angular/core
for more information read here https://github.com/just-jeb/angular-builders/blob/master/MIGRATION.MD