[Vue warn]: Unknown custom element: <router-view> in VUE + Laravel

vue-router

#1

Hello everyone,

Installed a latest laravel, then installed npm for vue and run.

then fire command npm install --save vue-router@latest

then in app.js added code

require(’./bootstrap’);

window.Vue = require(‘vue’);
import VueRouter from ‘vue-router’

Vue.use(VueRouter)

const example = require(’./components/ExampleComponent.vue’);
const routes = [
{
path: ‘/example’,
component: example
}
];

const router = new VueRouter({
routes
})
const app = new Vue({
el: ‘#app’,
router
});

then added code in welcome.blade.php

    <div id="app">
        <div class="topnav">
          <router-link class="active" to="/">Home</router-link>
        </div>
        <router-view></router-view>
    </div>
    <script type="text/javascript" src="{{ asset('js/app.js') }}"></script>

then I got error

[Vue warn]: Unknown custom element: router-link - did you register the component correctly? For recursive components, make sure to provide the “name” option.

[Vue warn]: Unknown custom element: router-view - did you register the component correctly? For recursive components, make sure to provide the “name” option.

Please help me ASAP.