nativescript vue tns生成的应用程序get-TypeError:无法读取属性';在';未定义的

nativescript vue tns生成的应用程序get-TypeError:无法读取属性';在';未定义的,nativescript,nativescript-vue,Nativescript,Nativescript Vue,我根据以下建议生成应用程序: 在预览阶段,我得到以下错误: LOG from device HUAWEI P10 lite: com.tns.NativeScriptException: Error calling module function TypeError: Cannot read property 'on' of undefined File: "file:///data/data/org.nativescript.preview/files/app/vendor.js, line:

我根据以下建议生成应用程序:

在预览阶段,我得到以下错误:

LOG from device HUAWEI P10 lite: com.tns.NativeScriptException: Error calling module function
TypeError: Cannot read property 'on' of undefined
File: "file:///data/data/org.nativescript.preview/files/app/vendor.js, line: 3254, column: 2085

StackTrace:
        Frame: function:'srcBackendJs', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 3254, column: 2086
        Frame: function:'__webpack_require__', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 12, column: 27
        Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 27, column: 16
        Frame: function:'../node_modules/@vue/devtools/build/backend.js', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 27, column: 88
        Frame: function:'__webpack_require__', file:'file:///data/data/org.nativescript.preview/files/app/runtime.js', line: 751, column: 30
        Frame: function:'fn', file:'file:///data/data/org.nativescript.preview/files/app/runtime.js', line: 121, column: 20
        Frame: function:'connect', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 6334, column: 5
        Frame: function:'setupDevtools', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 7417, column: 16
        Frame: function:'Vue.$start', file:'file:///data/data/org.nativescript.preview/files/app/vendor.js', line: 7441, column: 7
        Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/bundle.js', line: 329, column: 4
        Frame: function:'./main.ts', file:'file:///data/data/org.nativescript.preview/files/app/bundle.js', line: 335, column: 30
        Frame: function:'__webpack_require__', file:'file:///data/data/org.nativescript.preview/files/app/runtime.js', line: 751, column: 30
        Frame: function:'checkDeferredModules', file:'file:///data/data/org.nativescript.preview/files/app/runtime.js', line: 44, column: 23
        Frame: function:'webpackJsonpCallback', file:'file:///data/data/org.nativescript.preview/files/app/runtime.js', line: 31, column: 19
        Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/bundle.js', line: 2, column: 57
        Frame: function:'require', file:'', line: 1, column: 266


TypeError: Cannot read property 'on' of undefined
        at com.tns.Runtime.runModule(Native Method)
        at com.tns.Runtime.runModule(Runtime.java:663)
        at com.tns.Runtime.run(Runtime.java:655)
        at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1122)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6619)
        at android.app.ActivityThread.-wrap2(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7529)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
我在Windows10上运行,手机是安卓华为

vue --version
3.11.0

我尝试了Javascript和TypeScript,vuex尝试了yes和no,scheme none和light。没有工作。

我在这里创建了一个新的测试项目,遵循了所有步骤,工作正常

您可能的进一步选择:

  • 清除以前的安装
  • 再次考虑安装 全球范围内的npm(
    npm-g
  • 检查
    tns-doctor
    以查看是否安装了所有要求并且是最新的({N}6.1 已于9月3日发布)
  • 完成所有工作后,根据需要生成新项目
  • 使用
    warn
    (warn句柄
    Vue
    项目)安装本地依赖项 非常好)纱线安装
  • 运行
    tns运行android

  • ps:尝试安装
    AVD
    或连接到实际设备,以确保其正常工作我在Nativescript社区slack上收到Igor的响应。他提到我在生成应用程序时启用了vue devtools选项


    我在vue devtools上重新生成了一个应用程序select No,一切正常。

    我也有同样的错误。这是由于在使用
    VueDevTools
    时,包
    @vue/devtools
    nativescript socketio
    交互造成的

    要修复此问题,请从devDependencies卸载包
    nativescript socketio
    ,并将其作为正常依赖项重新安装:

    纱线删除nativescript socketio和纱线添加nativescript socketio
    
    谢谢@MatheusFelipe。我在slack频道收到Igor的回复。原因是我在生成应用程序时启用了vue devtools。为了其他人的利益,我在下面添加了一个答案。“是”是vue devtools在生成应用程序时的默认选项
    vue --version
    3.11.0