【问题标题】:tns preview not working on android with nativescript-vuetns 预览不适用于带有 nativescript-vue 的 android
【发布时间】:2019-04-19 10:44:03
【问题描述】:

我创建了一个超级简单的应用程序,它有 3 个选项卡和一个使用 http 调用/axios 生成的列表。

当我运行 tns run android --bundle 时一切正常,但是当我在我的 Android 手机上使用 Playground 应用程序尝试 tns preview 时出现此错误:

Cannot compile /data/data/org.nativescript.preview/files/app/main.js

SyntaxError: Unexpected identifier
File: "file:///data/data/org.nativescript.preview/files/app/main.js, line: 1, column: 67

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266


SyntaxError: Unexpected identifier
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266


    at com.tns.Runtime.runModule(Native Method)
    at com.tns.Runtime.runModule(Runtime.java:553)
    at com.tns.Runtime.run(Runtime.java:545)
    at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1028)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5658)
    at android.app.ActivityThread.-wrap2(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:6523)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)

Executing after-watch hook from /home/badr/projects/ns/annuaire/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
Executing after-watch hook from /home/badr/projects/ns/annuaire/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
Executing after-watch hook from /home/badr/projects/ns/annuaire/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch

【问题讨论】:

    标签: nativescript nativescript-vue


    【解决方案1】:

    您缺少tns preview 命令的--bundle 标志。它应该适用于tns preview --bundle

    --bundle 标志负责运行 webpack,它编译 .vue 文件。

    【讨论】:

      猜你喜欢
      • 2020-12-04
      • 2020-05-19
      • 2019-04-09
      • 1970-01-01
      • 2020-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多