Cannot find module '@angular-devkit/build-ng-package code example

Example 1: Cannot find module '@angular-devkit/build-angular/package.json'

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