nativescript-cli: System.err: Calling js method onCreate failed - System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap

Environment

{
  "name": "farm-management-ui",
  "description": "The UI for farm management",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "android": "tns run android --bundle",
    "ios": "tns run ios --bundle",
    "mobile": "tns run --bundle",
    "preview": "tns preview --bundle",
    "ng": "ng",
    "start": "ng serve --base-href=/ui/",
    "start-local-prod": "ng serve --base-href=/ui/",
    "start-traci": "ng serve --configuration=traci-dev --base-href=/ui/",
    "build": "ng build --prod --base-href=/ui/",
    "build-traci": "ng build --prod --configuration=traci --base-href=/ui/",
    "test": "ng test --code-coverage=true",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "loco": "node tools/update-localized-strings.js",
    "bundle-report": "webpack-bundle-analyzer dist/stats.json",
    "licenses": "node tools/extract-licenses.js"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/architect": "^0.13.9",
    "@angular-devkit/build-optimizer": "^0.13.9",
    "@angular-devkit/build-webpack": "^0.13.9",
    "@angular-devkit/core": "^7.3.9",
    "@angular/animations": "^7.2.0",
    "@angular/cdk": "^7.2.1",
    "@angular/common": "7.2.0",
    "@angular/compiler": "7.2.0",
    "@angular/core": "7.2.0",
    "@angular/forms": "7.2.0",
    "@angular/http": "7.2.0",
    "@angular/material": "^7.2.1",
    "@angular/platform-browser": "7.2.0",
    "@angular/platform-browser-dynamic": "7.2.0",
    "@angular/router": "7.2.0",
    "@asymmetrik/ngx-leaflet": "^3.0.2",
    "@asymmetrik/ngx-leaflet-draw": "^2.7.1",
    "@asymmetrik/ngx-leaflet-markercluster": "^1.0.0",
    "@bwc/bwc-button": "^2.0.5",
    "@bwc/bwc-footer": "^2.0.2",
    "@bwc/bwc-header": "^4.1.2",
    "@bwc/bwc-input": "^2.2.2",
    "@bwc/bwc-overlay": "^3.0.6",
    "@bwc/bwc-style": "^2.1.0",
    "@inst-iot/bosch-angular-ui-components": "^0.3.20",
    "@nativescript/schematics": "^0.6.0",
    "@ng-bootstrap/ng-bootstrap": "^4.0.1",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@schematics/angular": "^7.3.9",
    "@swimlane/ngx-datatable": "^14.0.0",
    "@types/geojson": "^1.0.6",
    "@types/leaflet": "^1.2.6",
    "@types/leaflet.markercluster": "^1.0.3",
    "@types/leaflet.pm": "^0.13.3",
    "@webcomponents/webcomponentsjs": "^2.2.4",
    "angular-2-local-storage": "^1.0.1",
    "bootstrap-daterangepicker": "^3.0.3",
    "bosch-bootstrap": "git+https://products.bosch-si.com/stash/scm/instiot/bosch-bootstrap.git#v4",
    "brace": "^0.10.0",
    "chart.js": "^2.7.2",
    "chartjs-plugin-annotation": "^0.5.7",
    "chartjs-plugin-zoom": "^0.6.6",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.1",
    "file-saver": "^1.3.8",
    "flatpickr": "^4.5.7",
    "font-awesome": "^4.7.0",
    "jquery": "^3.3.1",
    "json-formatter-js": "^2.2.0",
    "leaflet": "^1.3.1",
    "leaflet-draw": "^1.0.2",
    "leaflet-easybutton": "^2.3.0",
    "leaflet.markercluster": "^1.3.0",
    "leaflet.pm": "^0.22.0",
    "magic-string": "^0.22.4",
    "moment": "^2.19.4",
    "nan": "^2.14.0",
    "nativescript-angular": "~7.2.0",
    "nativescript-theme-core": "~1.0.4",
    "ng2-ace-editor": "^0.3.3",
    "ng5-slider": "^1.1.3",
    "ngx-clipboard": "^12.1.2",
    "ngx-gallery": "^4.3.0",
    "ngx-toastr": "^10.0.2",
    "ngx-ui-switch": "^6.0.3",
    "popper.js": "^1.13.0",
    "puppeteer": "^1.17.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.3.3",
    "sass-loader": "^6.0.5",
    "tmp": "0.0.30",
    "tns-core-modules": "^5.4.3",
    "tslib": "^1.9.0",
    "uuid": "^3.3.2",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.27"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.12.4",
    "@angular/cli": "^7.3.9",
    "@angular/compiler-cli": "8.0.0",
    "@angular/language-service": "7.2.0",
    "@nativescript/schematics": "0.6.0",
    "@types/chart.js": "^2.7.18",
    "@types/jasmine": "2.8.6",
    "@types/leaflet-draw": "^0.4.11",
    "@types/node": "^6.0.92",
    "codelyzer": "^4.2.1",
    "https-proxy-agent": "^2.1.1",
    "jasmine-core": "^2.99.1",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "^1.7.1",
    "karma-chrome-launcher": "^2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-firefox-launcher": "^1.0.1",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-spec-reporter": "0.0.32",
    "license-checker": "^21.0.0",
    "nativescript-dev-webpack": "^0.24.1",
    "node-sass": "^4.12.0",
    "protractor": "~5.1.2",
    "rxjs-tslint": "^0.1.6",
    "style-loader": "^0.23.1",
    "ts-node": "~3.0.4",
    "tslint": "^5.10.0",
    "typescript": "^3.4.5"
  },
  "nativescript": {
    "id": "org.nativescript.ngsample",
    "tns-android": {
      "version": "5.4.0"
    }
  }
}

Describe the bug

I have a web application using Angular version 7 and decided to migrate it into a mobile application using NativeScript. After installing successfully nativescript and the schemantics plugins, I tried to run tns run android --bundle on an Android Emulator(Nexus 4 API 8), but I am getting the following error:

System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.ngsample/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: System.err: Calling js method onCreate failed System.err: System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap. System.err: File: "file:///data/data/org.nativescript.ngsample/files/app/vendor.js, line: 21913, column: 20 System.err: System.err: StackTrace: System.err: Frame: function:‘push…/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent’, file:‘file:///data/data/org.nativescript.ngsample/files/app/vendor.js’, line: 21913, column: 27 System.err: Frame: function:‘push…/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate’, file:‘file:///data/data/org.nativescript.ngsample/files/app/vendor.js’, line: 21758, column: 14 System.err: Frame: function:‘push…/node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate’, file:‘file:///data/data/org.nativescript.ngsample/files/app/vendor.js’, line: 19571, column: 25 System.err: System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:193) System.err: at android.app.ActivityThread.main(ActivityThread.java:6669) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) System.err: Caused by: com.tns.NativeScriptException: System.err: Calling js method onCreate failed System.err: System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap. System.err: File: "file:///data/data/org.nativescript.ngsample/files/app/vendor.js, line: 21913, column: 20 System.err: System.err: StackTrace: System.err: Frame: function:‘push…/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent’, file:‘file:///data/data/org.nativescript.ngsample/files/app/vendor.js’, line: 21913, column: 27 System.err: Frame: function:‘push…/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate’, file:‘file:///data/data/org.nativescript.ngsample/files/app/vendor.js’, line: 21758, column: 14 System.err: Frame: function:‘push…/node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate’, file:‘file:///data/data/org.nativescript.ngsample/files/app/vendor.js’, line: 19571, column: 25 System.err: System.err: at com.tns.Runtime.callJSMethodNative(Native Method) System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203) System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1083) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1070) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1050) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1042) System.err: at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19) System.err: at android.app.Activity.performCreate(Activity.java:7136) System.err: at android.app.Activity.performCreate(Activity.java:7127) System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) System.err: … 11 more

To Reproduce tns run android --bundle

Expected behavior Application should be executed successfully and show the auto-generated code.

I cannot upload the whole application, as my client does not allow me but if some parts of the application are needed, please let me know to share them.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Hi @Karabillie,

I’m closing the issue as we’ve isolated the problem and the issue with not pausing on Webpack errors is already logged.

@Karabillie,

It seems that no .js files are emitted due to the error you mention.

ERROR in e2e/app.e2e-spec.ts(12,45): error TS2345: Argument of type ‘“Welcome to app!!”’ is not assignable to parameter of type ‘Expected<Promise>’.

This is expecting to happen when noEmitOnError: true is set in your tsconfig.json file. We’re trying to set it to false - noEmitOnError: false and expecting that .js files will be emitted and this will resolve the issue. However, this didn’t help us and still no.js files were emitted.

After investigating the issue, we found that the problem is in AngularCompilerPlugin and the way it handles typescript’s compiler errors and options. We opened a PR in angular-cli repo fixing the described behavior - https://github.com/angular/angular-cli/pull/15199.

Meanwhile, you can fix your compilation error in e2e/app.e2e-spec.ts file in order to workaround this issue.