Route Error in Vue js

0

My App.Vue

<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'app',
  data () {
    return {

    }
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

</style>

My Home.Vue component

<template>
  <div>
    <h1>Home</h1>
  </div>
</template>

<script>
export default {

}
</script>

<style>

</style>

My main.js

import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-route';
import Home from './components/home/Home.vue';

Vue.use(VueRouter);


var router = new VueRouter({
  routes: [
    { path: '/', component: Home },
  ]
})

new Vue({
  el: '#app',
  router,
  render: h => h(App)
})

I'm having this error, I'm using the vue-route

  

TypeError: Vue.directive is not a function

    
asked by anonymous 05.09.2017 / 22:58

1 answer

1

As far as I can see import of VueRouter is spelled wrong, there was a r

Should be:

import VueRouter from 'vue-router'
    
05.09.2017 / 23:05