Npm.cmd run ionic:build:after exited with exit code 1

Getting the below error. Here are most of the installations I’ve performed (some are redundant).

npm i @angular-devkit/build-angular
npm install @ionic/angular-toolkit@latest
npm update -g cordova
npm install -g cordova-res native-run
cordova platform update
npm install -g npm@latest
npm install -g @angular/cli
npm i -D @angular-devkit/build-angular@latest
npm i @angular-devkit/core
npm install --save-dev @angular-devkit/core
npm install @ionic/app-scripts@latest --save-dev
npm install -g @ionic/cli


> npm.cmd run ionic:build:after

> engage@0.0.1 ionic:build:after C:\Dev\northcoast\mi-mobile
> csd generate

C:\Users\COSullivan\AppData\Roaming\npm\node_modules\cordova-sqlite-devtools\dist\index.js:29
    .command('list')
     ^

TypeError: program.command is not a function
    at Object.<anonymous> (C:\Users\COSullivan\AppData\Roaming\npm\node_modules\cordova-sqlite-devtools\dist\index.js:29:6)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\COSullivan\AppData\Roaming\npm\node_modules\cordova-sqlite-devtools\bin\csd:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! engage@0.0.1 ionic:build:after: `csd generate`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the engage@0.0.1 ionic:build:after script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\COSullivan\AppData\Roaming\npm-cache\_logs\2020-12-11T20_58_31_066Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm.cmd run ionic:build:after exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! engage@0.0.1 start: `ionic cordova run android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the engage@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\COSullivan\AppData\Roaming\npm-cache\_logs\2020-12-11T20_58_31_148Z-debug.log

FYI: you don’t need @ionic/app-scripts for modern Ionic projects. It was obsoleted after v3 of the framework.

Your proximate problem seems to be that cordova-sqlite-devtools 1.2.1 is broken. I get the same error you do, and downgrading it by npm i cordova-sqlite-devtools@1.2.0 fixes it for me.

Solved the issue on my end as well. Thanks.