vlad
vlad

Reputation: 112

Which package is needed to import vue components?

I'm new to nativescript and "npm-related" development development and trying to create my first NativeScript-Vue application, and have got some troubles.

1) First of all, when I use the import Vue from 'nativescript-vue'; syntax instead of const Vue = require('nativescript-vue'); I get such exception:

    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) When trying to import vue components(with .vue extension) they are not even being found..

    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/

I suppose I have some packages missing, but have no idea which exactly.

Here is my 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": {}

Upvotes: 1

Views: 95

Answers (1)

Manoj
Manoj

Reputation: 21908

Your dependencies seems pretty much old, the current nativescript-vue version is v2.2.0 and tns-core-modules is on v5.5.2.

Try using the official starter templates to create project via CLI.

Upvotes: 1

Related Questions