导入vue组件需要哪个包?
Which package is needed to import vue components?
我是 nativescript 和 "npm-related" 开发的新手,正在尝试创建我的第一个 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": {}
您的依赖项似乎很旧,当前 nativescript-vue
版本是 v2.2.0
并且 tns-core-modules
在 v5.5.2
.
尝试使用官方入门模板通过 CLI 创建项目。
我是 nativescript 和 "npm-related" 开发的新手,正在尝试创建我的第一个 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": {}
您的依赖项似乎很旧,当前 nativescript-vue
版本是 v2.2.0
并且 tns-core-modules
在 v5.5.2
.
尝试使用官方入门模板通过 CLI 创建项目。