-
-
Notifications
You must be signed in to change notification settings - Fork 241
Description
With 5.0.0
, a dependency I was using now causes an exception. Switching back to 4.*.*
fixes the issue. In my case I'm using fuzzball, whose default module has a dependency tree with node standard modules that are not available in Nativescript. Instead, I'm using the minified umd version which has worked up until nativescript-angular: 5.0.0
and Angular 5. Here is the stack trace for iOS:
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x10fce57b4 -[TNSRuntime executeModule:referredBy:]
2 0x10f7dbc71 main
3 0x11377565d start
JavaScript stack trace:
1 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:14902
2 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:15068
3 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:15147
4 s@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:693
5 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:741
6 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:1893
7 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:17113
8 s@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:693
9 e@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:861
10 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:877
11 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:159
12 anonymous@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:392
13 evaluate@[native code]
14 moduleEvaluation@[native code]
15 @[native code]
16 promiseReactionJob@[native code]
17 require@[native code]
18 anonymous@file:///app/app.component.js:4:23
19 evaluate@[native code]
20 moduleEvaluation@[native code]
21 @[native code]
22 promiseReactionJob@[native code]
23 require@[native code]
24 anonymous@file:///app/app.module.js:6:30
25 evaluate@[native code]
26 moduleEvaluation@[native code]
27 @[native code]
28 promiseReactionJob@[native code]
29 require@[native code]
30 anonymous@file:///app/main.js:5:27
31 evaluate@[native code]
32 moduleEvaluation@[native code]
33 @[native code]
34 promiseReactionJob@[native code]
JavaScript error:
file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:14902: JS ERROR TypeError: doc.createElement is not a function. (In 'doc.createElement("script")', 'doc.createElement' is undefined)
I'm including a sample project whose package.json you can change to the following in order to no longer get this error:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.dependencyerror",
"tns-ios": {
"version": "3.4.0"
}
},
"dependencies": {
"@angular/animations": "~4.4.6",
"@angular/common": "~4.4.6",
"@angular/compiler": "~4.4.6",
"@angular/core": "~4.4.6",
"@angular/forms": "~4.4.6",
"@angular/http": "~4.4.6",
"@angular/platform-browser": "~4.4.6",
"@angular/platform-browser-dynamic": "~4.4.6",
"@angular/router": "~4.4.6",
"allow-publish": "^1.0.4",
"fuzzball": "^0.13.6",
"nativescript-angular": "~4.4.1",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.5.2",
"tns-core-modules": "~3.4.0",
"zone.js": "~0.8.2"
},
"devDependencies": {
"nativescript-dev-typescript": "~0.5.0",
"typescript": "~2.4.2"
}
}
Finally, here is the unminified version of the block that fails:
if ({}.toString.call(global.process) === "[object process]") {
installNextTickImplementation()
} else if (canUsePostMessage()) {
installPostMessageImplementation()
} else if (global.MessageChannel) {
installMessageChannelImplementation()
} else if (doc && "onreadystatechange" in doc.createElement("script")) {
installReadyStateChangeImplementation()
} else {
installSetTimeoutImplementation()
}
Edit:
Attaching project. Also, this error can be fixed by changing the line
else if (doc && "onreadystatechange" in doc.createElement("script"))
to
else if (doc && document.createElement && "onreadystatechange" in doc.createElement("script"))
dependency-error.zip