TypeError: Object prototype may only be an Object or null: undefined at setPrototypeOf (native)

Hi guys ,
maybe you can help me to investigate this issue …
when I’m running my build like :

ionic cordova run android --release -> have no issues and all good

ionic cordova run android --release – prod I got this error and I try to find out what is that :

TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf (native)
at Object.__extends (/Users/x/projects/y/node_modules/tslib/tslib.js:64:9)
at /Users/x/projects/y/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:115:17
at /Users/x/projects/y/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:314:6
at Object.defineProperty.value (/Users/x/projects/y/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:3:17)
at Object. (/Users/x/projects/y/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:9:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)

Anyone ?

I am getting the same error. How did you resolve this?

still looking for away to understand how to debug it on run time …
have no clue .
maybe ionic team can answer this question

I am facing the same issue for the commaind “ionic build --prod”. If there is a solution kindly share.

Hi

Just installed new node.js (version 10) and all node_modules again , no resolve for the issue.

starting to think moving to NativeScript\ReactNative due to UnInformative Build errors .

anyway , ill put here the the IONIC 3 environment info :slight_smile:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.2.4
Cordova Platforms  : android 6.4.0 ios 4.5.5
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2 
ios-sim    : 5.0.4 
Node       : v10.16.3
npm        : 6.9.0 
OS         : macOS
Xcode      : Xcode 10.3 Build version 10G8 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

I have the same problem, did you fix it?

Nope … still looking for solution and a way to investigate it.
this is what is going on … --prod --verbose :

[18:05:46] ngc started …
TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf ()
at Object.__extends (/Users/x/projects/x/node_modules/tslib/tslib.js:64:9)
at /Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:115:17
at /Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:314:6
at /Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:3:17
at Object. (/Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:9:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
[DEBUG] TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf ()
at Object.__extends (/Users/x/projects/x/node_modules/tslib/tslib.js:64:9)
at
/Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:115:17
at
/Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:314:6
at
/Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:3:17
at Object.
(/Users/x/projects/x/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:9:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

Fixed by removing the node_modules inside ng2-swipe package in the project …
(and doing it again each time npm i done in the project)

Facing the same error on ‘ionic cordova build android --prod’. Tried removing node_modules folder and npm install but nothing is working. Any solutions?

Hi @t4tapas, did you solve this to get work. Thanks

Yes. In my case in my package.json class all angular version was 5.2.11 but @angular/compiler-cli version was 8. So I changed it to 5.2.11, deleted node_modules and did npm install. It worked.

4 Likes