`“主”线程上发生未捕获的异常。`新应用上发生了错误

时间:2019-09-30 06:51:12

标签: angular nativescript

我需要帮助。

当我使用命令ng new -c=@nativescript/schematics ns6 --shared --style=scss创建新的代码共享应用时,在tns run andriod上出现如下错误。

有人可以帮我吗?

它也无法在iOS上运行。

但是它可以在没有代码共享的情况下工作。

要注意的一件事是:一年前,我安装了Nativescript环境。我刚刚更新了Nativescript并尝试运行。

  • 我什至安装了@ nativescript / schematics @ 0.3.0-rc.1,但仍然无法正常工作。
ERROR in node_modules/@types/jasminewd2/index.d.ts(8,23): error TS2688: Cannot find type definition file for 'jasmine/v2'.

System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{org.nativescript.ns6/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap.
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.ns6/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap.
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3115)
System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3258)
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:1955)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     at android.os.Looper.loop(Looper.java:214)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7073)
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:964)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap.
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1083)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1063)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1055)
System.err:     at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19)
System.err:     at android.app.Activity.performCreate(Activity.java:7327)
System.err:     at android.app.Activity.performCreate(Activity.java:7318)
System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1275)
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3095)
System.err:     ... 11 more
Successfully synced application org.nativescript.ns6 on device 320066b04746b53d.

package.json

{
  "name": "ns6",
  "nativescript": {
    "id": "org.nativescript.ns6",
    "tns-android": {
      "version": "6.1.2"
    }
  },
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "android": "tns run android",
    "ios": "tns run ios",
    "mobile": "tns run",
    "preview": "tns preview"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.0.1",
    "@angular/common": "~8.0.1",
    "@angular/compiler": "~8.0.1",
    "@angular/core": "~8.0.1",
    "@angular/forms": "~8.0.1",
    "@angular/http": "~8.0.0-beta.10",
    "@angular/platform-browser": "~8.0.1",
    "@angular/platform-browser-dynamic": "~8.0.1",
    "@angular/router": "~8.0.1",
    "core-js": "^2.5.4",
    "nativescript-angular": "~8.0.1",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.12",
    "rxjs": "~6.5.0",
    "tns-core-modules": "~6.0.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/cli": "~8.0.3",
    "@angular/compiler-cli": "~8.0.1",
    "@angular-devkit/build-angular": "~0.800.0",
    "@nativescript/schematics": "~0.7.0",
    "@nativescript/tslint-rules": "~0.0.2",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "nativescript-dev-webpack": "~1.0.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3",
    "node-sass": "^4.7.1"
  }
}

NativeScript版本

$ tns --version
6.1.2

Angular版本

$ ng --version
Your global Angular CLI version (8.3.5) is greater than your local
version (8.0.6). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.0.6
Node: 10.16.0
OS: darwin x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.6
@angular-devkit/build-angular     0.800.6
@angular-devkit/build-optimizer   0.800.6
@angular-devkit/build-webpack     0.800.6
@angular-devkit/core              8.0.6
@angular-devkit/schematics        8.0.6
@angular/cli                      8.0.6
@angular/http                     8.0.0-beta.10
@ngtools/webpack                  8.0.6
@schematics/angular               8.0.6
@schematics/update                0.800.6
rxjs                              6.5.3
typescript                        3.4.5
webpack                           4.30.0

本机原理图版本

~/tmp/ns6 $ npm list -g --depth=0
/usr/local/lib
├── @nativescript/schematics@0.7.1

1 个答案:

答案 0 :(得分:1)

删除ERROR in node_modules/@types/jasminewd2/index.d.ts(8,23): error TS2688: Cannot find type definition file for 'jasmine/v2'.后,它可以正常工作。

我只是删除了/// <reference types="jasmine/v2" />,它在Android和iOS上都可以使用