4

I am facing the following error when running ionic cordova build android --prod for my Ionic3 project. There is no error on just ionic cordova build android.

ionic-app-script task: "build" 
TypeError: Object prototype may only be an Object or null: undefined 
TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at Object.__extends (/Users/.../node_modules/tslib/tslib.js:64:9)
    at /Users/.../node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:115:17
    at /Users/.../node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:314:6
    at /Users/.../node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:3:17
    at Object.<anonymous> (/Users/.../node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:9:3)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
[ERROR] An error occurred while running subprocess ionic-app-scripts.

I have tried all the solutions on here but it's not working.

Following are my ionic details.

Ionic:

   Ionic CLI          : 5.4.13 (/Users/meuser/.nvm/versions/node/v12.6.0/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.9
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.1.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 1.1.1, (and 18 other plugins)

Utility:

   cordova-res : 0.8.1
   native-run  : 0.3.0

EDIT:

Details on ng v

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.23
@angular-devkit/build-optimizer   0.0.35
@angular-devkit/core              8.3.23
@angular-devkit/schematics        8.3.23
@angular/cli                      8.3.23
@angular/compiler-cli             8.2.12
@angular/fire                     5.3.0
@schematics/angular               8.3.23
@schematics/update                0.803.23
rxjs                              6.5.4
typescript                        3.7.5
webpack                           3.12.0

package.json

  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "^8.2.12",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
}
3
  • The error seems to come from the Angular CLI. Which version do you have? Maybe installing the most recent one or going back one version fixes it. Commented Jan 21, 2020 at 18:25
  • I have added the version details for ng. Could you please take a look and help. Commented Jan 21, 2020 at 18:58
  • Thanks for pointing out Angular CLI. I figured out the issue. Commented Jan 21, 2020 at 20:34

2 Answers 2

1

Finally found the issue. I changed "@angular/compiler-cli": "^8.2.12" to "@angular/compiler-cli": "5.2.11" as per my angular versions and it worked fine.

Sign up to request clarification or add additional context in comments.

Comments

0

Delete your node_modules folder. Delete your platform android folder (the entire platform folder or just android folder).

 Run npm install

Add platform android

ionic cordova platform add android

Build your app again

ionic cordova build android --prod

2 Comments

I already tried it many times. Tried again. Still getting the same error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.