导入vue组件需要哪个软件包?

时间:2019-03-24 09:36:02

标签: nativescript nativescript-vue

我不熟悉Nativescript和与“ npm相关”的开发,并且尝试创建我的第一个NativeScript-Vue应用程序,但是遇到了一些麻烦。

1)首先,当我使用import Vue from 'nativescript-vue';语法而不是const Vue = require('nativescript-vue');时,出现了这样的异常:

    An uncaught Exception occurred on "main" thread.
    java.lang.RuntimeException: Unable to create application 
    com.tns.NativeScriptApplication: com.tns.NativeScriptException: 

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

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

2)尝试导入带有.vue扩展名的vue组件时,甚至找不到它们。

    An uncaught Exception occurred on "main" thread.
    java.lang.RuntimeException: Unable to create application 
    com.tns.NativeScriptApplication: com.tns.NativeScriptException: 

    Error calling module function 

    Error: com.tns.NativeScriptException: Failed to find module: 
    "./components/test", relative to: app/

我想我有一些包裹丢失了,但是不知道到底是哪个包裹。

这是我的package.json:

    "nativescript": {
           "id": "org.nativescript.sirius",
            "tns-android": {
               "version": "5.2.1"
        }
     },
   "dependencies": {
           "nativescript-theme-core": "^1.0.4",
           "nativescript-vue": "^1.3.1",
           "tns-core-modules": "^3.4.1"
    },
   "devDependencies": {}

1 个答案:

答案 0 :(得分:1)

您的依赖项似乎已经很旧了,当前的nativescript-vue版本是v2.2.0,而tns-core-modulesv5.5.2上。

尝试使用官方入门模板通过CLI创建项目。

相关问题