ng has unexpectedly closed (exit code 2) code example
Example: ng has unexpectedly closed (exit code 127).
npm install @ionic/app-scripts@latest --save-dev
// being in root directory of your project
npm install @ionic/app-scripts@latest --save-dev
// being in root directory of your project