Nativescript-angular: [5.3.0] app crashes with "System.err: TypeError: application_1.run is not a function"

Created on 10 Apr 2018  路  3Comments  路  Source: NativeScript/nativescript-angular

After upgrading to 5.3.0 I'm getting this error:

System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
System.err:
System.err: Error calling module function
System.err:
System.err: TypeError: application_1.run is not a function
System.err: File: "file:///data/data/io.neocles.dev/files/app/tns_modules/nativescript-angular/platform-common.js, line: 158, column: 22
System.err:
System.err: StackTrace:
System.err:     Frame: function:'NativeScriptPlatformRef.bootstrapNativeScriptApp', file:'file:///data/data/io.neocles.dev/files/app/tns_modules/nativescript-angular/platform-common.js', line: 158, column: 23
System.err:     Frame: function:'NativeScriptPlatformRef.bootstrapApp', file:'file:///data/data/io.neocles.dev/files/app/tns_modules/nativescript-angular/platform-common.js', line: 92, column: 14
System.err:     Frame: function:'NativeScriptPlatformRef.bootstrapModule', file:'file:///data/data/io.neocles.dev/files/app/tns_modules/nativescript-angular/platform-common.js', line: 81, column: 14
System.err:     Frame: function:'', file:'file:///data/data/io.neocles.dev/files/app/main.js', line: 11, column: 76
System.err:     Frame: function:'require', file:'', line: 1, column: 266

Downgrading back to 5.2.0 solves the issue.

Most helpful comment

So what happened is this: my package.json was referring to tns-core-modules with ^3.4.1 and nativescript-angular ^5.2.0. When our build server did an npm install, this got resolved to tns-core-modules 3.4.1 and nativescript-angular 5.3.0 - 5.3.0 being incompatible with 3.4.1. Only after upgrading to tns-core-modules 4.0.0 (major upgrade) did things work as expected.

All 3 comments

So what happened is this: my package.json was referring to tns-core-modules with ^3.4.1 and nativescript-angular ^5.2.0. When our build server did an npm install, this got resolved to tns-core-modules 3.4.1 and nativescript-angular 5.3.0 - 5.3.0 being incompatible with 3.4.1. Only after upgrading to tns-core-modules 4.0.0 (major upgrade) did things work as expected.

@Burgov happy to hear you have found the solution!
I can confirm that indeed version 5.3.0 of nativescript-angular is coming with some breaking changes and integration with [email protected] but is not compatible with tns-core-modules 3.4.x and below.

I would advise using tilde {~} patch versioning instead of using the caret (^) for minor versioning.
This way npm i for ~5.2.0 will update only the patch version (versions within 5.2.0 - 5.2.9) while the caret would update the minor version (5.0.0 - 5.9.9)

Just wanted to take a second to thank you @Burgov, for taking the time to write this up and coming back to post your solution. I just did the _exact_ same thing and you saved me a ton of frustration 馃憤馃徎

Was this page helpful?
0 / 5 - 0 ratings