Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

681
Views
Module not found: Error: Can't resolve './router'| Vue router

in search.js from this file:

import {createRouter, createWebHistory} from "vue-router";

import SearchIndex from './components/omdb/SearchIndex.vue'

const routes = [
    {
        path: '/',
        name: 'welcome',
        component: SearchIndex
    },
]

export default createRouter({
    history: createWebHistory(),
    routes
})

in app.js from this file:

require('./bootstrap');

require('alpinejs');

import { createApp } from "vue";
import router from './router'
import SearchIndex from './components/omdb/SearchIndex'


createApp({
    components:{
        SearchIndex
    }
}).use(router).mount('#app')

this error:

ERROR in ./resources/js/app.js 6:0-30
Module not found: Error: Can't resolve './router' in 'D:\xampp\htdocs\omdb\resources\js'

I don't understand why it gives me this error. I structured the file as follows:

enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The module path in import router from './router' resolves to either ./router.js or ./router/index.js. Neither file exists, leading to the error you observed.

You can either rename ./router/search.js to ./router/index.js, or import the ./router/search.js file directly:

import router from './router/search'
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!