代码之家  ›  专栏  ›  技术社区  ›  Rakesh

webpack tns run android——bundle失败,其中“onnavigatingto”未定义

  •  0
  • Rakesh  · 技术社区  · 6 年前

    当我使用 tns run android 但当我使用 tns run android --bundle 然后它给了我一个例外,下面是一个stacktrace:

    System.err: com.tns.NativeScriptException:
    System.err: Calling js method onViewAttachedToWindow failed
    System.err: TypeError: Cannot read property 'onNavigatingTo' of undefined
    System.err: File: "file:///data/data/com.travel/files/app/vendor.js, line: 32768, column: 36
    System.err: StackTrace:
    System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame-common.js.FrameBase._onNavigatingTo', file:'file:///data/data/co
    m.travel/files/app/vendor.js', line: 32768, column: 37
    System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame-common.js.FrameBase.performNavigation', file:'file:///data/data/
    com.travel/files/app/vendor.js', line: 32740, column: 14
    System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame-common.js.FrameBase._processNextNavigationEntry', file:'file:///
    data/data/com.travel/files/app/vendor.js', line: 32733, column: 22
    System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.Frame._processNextNavigationEntry', file:'file:///data/data/c
    om.travel/files/app/vendor.js', line: 33206, column: 58
    System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.Frame._onAttachedToWindow', file:'file:///data/data/com.trav
    el/files/app/vendor.js', line: 33181, column: 14
    System.err:     Frame: function:'AttachListener.onViewAttachedToWindow', file:'file:///data/data/com.travel/files/app/vendor.js', line: 33
    098, column: 27
    System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
    

    以下是我的包.json

    {
      "nativescript": {
        "id": "com.travel",
      },
      "scripts": {
        "lint": "tslint \"app/**/*.ts\""
      },
      "dependencies": {
        "nativescript-appversion": "^1.4.1",
        "nativescript-grid-view": "^4.1.1",
        "nativescript-purchase": "^2.0.5",
        "nativescript-social-share": "^1.5.1",
        "nativescript-theme-core": "~1.0.4",
        "nativescript-toast": "^1.4.6",
        "nativescript-ui-chart": "^3.9.1",
        "nativescript-ui-sidedrawer": "~5.0.0",
        "rxjs": "~6.2.0",
        "tns-core-modules": "~5.0.0"
      },
      "devDependencies": {
        "nativescript-dev-sass": "~1.6.0",
        "nativescript-dev-typescript": "~0.7.0",
        "nativescript-dev-webpack": "^0.18.0",
        "tns-platform-declarations": "^5.0.2",
        "tslint": "~5.11.0",
        "typescript": "~2.7.2"
      }
    }
    

    有人能告诉我这里怎么了吗?完整的源代码可以在 https://github.com/rakeshgirase/NSWebpack

    1 回复  |  直到 6 年前
        1
  •  0
  •   Rakesh    6 年前

    这是一个错误。NativeScript Webpack需要以名称“page”结尾的fram页。我打开了一个问题,您可以从中获得更多详细信息 https://github.com/NativeScript/nativescript-dev-webpack/issues/775 .

    解决此问题的方法是将文件重命名为以“page”结尾的名称。