Home>

I got the error These relative modules were not found while using Vue router.

Probably there should be no file path or misspelling, but I didn't know what to do and got stuck.

Error message

These relative modules were not found:
* ../pages/About.vue in ./resources/js/router.js
* ../pages/Contact.vue in ./resources/js/router.js
* ./Header in ./node_modules/babel-loader/lib ??ref--4-0!./node_modules/vuetify-loader/lib/loader.js ??ref--11-0!./node_modules/vue -loader/lib ?? vue-loader-options! ./resources/js/App.vue?vue&type=script&lang=js&
import Vue from'vue';
import Router from "vue-router";
import Homepage from'/pages/Homepage.vue';
import About from'../pages/About.vue';
import Contact from'../pages/Contact.vue';
// Import page components
Vue.use (Router);
export default new Router ({
    routes: [
        {
            path:'/',
            name:'home',
            component: Homepage,
        },
        {
            path:'/ about',
            name:'about',
            component: About,
        },
        {
            path:'/ contact',
            name:'contact',
            component: Contact,
        }
    ]
});

I am sorry if there are any parts that I have overlooked because I am a beginner.
Thanks for your cooperation.

  • Answer # 1

    It seems that the method of specifying the file path was incorrect.
    I apologize to you for a fuss over.

    import Homepage from'./pages/Homepage.vue';
    import About from'./pages/About.vue';
    import Contact from'./pages/Contact.vue';
    import Header from'./components/Header';