NativeScript: iOS: 2.5.4, undefined is not an object (evaluating 'b.prototype')
iOS NS 2.5.4 Real device
I had a project successfully built and released ~3-4 weeks ago, I haven’t touched it since, and now I need to do some changes.
So, I simply run tns run ios
and for my surprise - it fails at startup screen:
Found peer TypeScript 2.1.6
2:08:04 PM - Compilation complete. Watching for file changes.
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0xb40cdb -[TNSRuntime executeModule:referredBy:]
2 0xc85d9
3 0x1b4ae4eb <redacted>
JavaScript stack trace:
1 @undefined:7:68
JavaScript error:
undefined:7:68: JS ERROR TypeError: undefined is not an object (evaluating 'b.prototype')
The same error happens if I build my project as AOT version.
In my package.json
I had tns ios "version": "2.5.0"
, and now, if I run tns run ios
, it will overwrite it to "version": "3.0.0"
. Could that be the cause?
package.json
:
{
"description": "Test Mobile Application",
"license": "",
"readme": "",
"repository": "",
"nativescript": {
"id": "com.app.test",
"tns-ios": {
"version": "2.5.0"
}
},
"dependencies": {
"@angular/common": "4.0.3",
"@angular/compiler": "4.0.3",
"@angular/core": "4.0.3",
"@angular/forms": "4.0.3",
"@angular/http": "4.0.3",
"@angular/platform-browser": "4.0.3",
"@angular/platform-browser-dynamic": "4.0.3",
"@angular/router": "4.0.3",
"PhoenixClient": "file:resources/PhoenixClient",
"base-64": "^0.1.0",
"nativescript-angular": "1.5.2",
"nativescript-angular-snapshot": "1.5.2-5.5.372.32",
"nativescript-camera": "3.0.0",
"nativescript-geolocation": "3.0.0",
"nativescript-gif": "1.0.9",
"nativescript-google-maps-sdk": "1.4.3",
"nativescript-imagepicker": "^2.5.1",
"nativescript-iqkeyboardmanager": "^1.0.1",
"nativescript-phone": "1.3.0",
"nativescript-vibrate": "1.1.2",
"nativescript-webview-interface": "^1.4.1",
"reflect-metadata": "0.1.10",
"rxjs": "5.3.1",
"tns-core-modules": "2.5.2",
"tns-platform-declarations": "2.5.2",
"zone.js": "0.8.9"
},
"devDependencies": {
"@angular/compiler-cli": "4.1.0",
"@ngtools/webpack": "1.2.13",
"babel-traverse": "6.24.1",
"babel-types": "6.24.1",
"babylon": "6.17.0",
"copy-webpack-plugin": "4.0.1",
"extract-text-webpack-plugin": "2.1.0",
"htmlparser2": "3.9.2",
"lazy": "1.0.11",
"nativescript-css-loader": "0.26.1",
"nativescript-dev-android-snapshot": "0.*.*",
"nativescript-dev-typescript": "0.4.2",
"nativescript-dev-webpack": "0.4.1",
"raw-loader": "0.5.1",
"resolve-url-loader": "2.0.2",
"typescript": "2.1.6",
"webpack": "2.4.1",
"webpack-sources": "0.2.3"
},
"scripts": {
"ns-bundle": "ns-bundle",
"start-android-bundle": "npm run ns-bundle --android --start-app",
"start-ios-bundle": "npm run ns-bundle --ios --start-app",
"build-android-bundle": "npm run ns-bundle --android --build-app",
"build-ios-bundle": "npm run ns-bundle --ios --build-app"
}
}
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"lib": [
"es2016",
"es2015.iterable"
],
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true
},
"exclude": [
"node_modules",
"platforms",
"**/*.aot.ts"
]
}
references.d.ts
:
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />
declare type Comment = any;
declare type CloseEvent = any;
declare type Document = any;
declare type DocumentFragment = any;
declare type Element = any;
declare type History = any;
declare type HTMLAnchorElement = any;
declare type HTMLCollection = any;
declare type HTMLDocument = any;
declare type HTMLElement = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Location = any;
declare type MessageEvent = any;
declare type MouseEvent = any;
declare type Node = any;
declare type NodeList = any;
declare type Text = any;
declare type WebSocket = any;
declare type HTMLMetaElement = any;
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 31 (12 by maintainers)
@NickIliev I have just run into this very ominous error as well. First time I’ve encountered it. The exact error is incredibly vague and soul crushing 😃
Are there any other ways to debug these JS errors with NativeScript? Here is a screenshot of the entire log output from XCode right when the app launches to show how incredibly difficult of a spot this leaves developers…
I’ve spent pretty much all day trying different things to find a solution to this issue and nothing has worked. Everything from:
vendor.ts
with all sorts of different configurationsvendor.js
(the built file - inside the built app) with various console.log’s to try and see what’s going onnoEmitHelpers
and/ormain
is set correctly and inspect their installed packages for inaccuracies. All check out.Nothing can find what is causing this error. Any tools the NativeScript team has which could help me get to the bottom of what in the world this error is and where it is coming from?
The only clue I’ve been able to tell is it somehow relates to the
__extends
function since that appears to be the only placeb.prototype
is called in all webpack files.I am using
nativescript-imagepicker
but latest version3.0.7
. I don’t think it is related to that plugin as I’ve tried removing that plugin altogether and the issue remains.@vakrilov @sis0k0 @rosen-vladimirov @PeterStaev