Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

676
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda