Ng run app:ionic-cordova-build --platform=android exited with exit code 127

I can’t build my project on Android/ios, please help. Getting the following error.

ng run app:ionic-cordova-build --platform=android
An unhandled exception occurred: Could not find the implementation for builder @ionic/angular-toolkit:cordova-build
See "/private/var/folders/fz/wgbf7rv17kzf3p1y4fkbvzv00000gp/T/ng-MWWVdc/angular-errors.log" for further details.
[ERROR] An error occurred while running subprocess ng.
        
        ng run app:ionic-cordova-build --platform=android exited with exit code 127.
        
        Re-running this command with the --verbose flag may provide more information.

I had the same problem with command: ionic cordova prepare android which got introduced when I upgraded my Angular CLI to version 8 (I was using Ionic 4.12.0).

As of Angular v8, the build process now compiles first for browsers which support ES2015 and afterwards for older browsers. Due to this reason, while upgrading the target within the compilerOptions in your tsconfig.json is set to es2015.

I reverted that to es5 and things started working again! However, I recommend you to use the es2015 for your build creation. We can just hope for the Ionic and Angular team to fix this issue in the later releases.

2 Likes

this didn’t work for me . Any additional ideas?

Yes. I am getting the same problem.
Any update is welcomed.