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

340
Vistas
The requested module '/weatherapp/node_modules/mysql/index.js' does not provide an export named 'default

I'm making a weather app that implements an SQL database conection. I send the queries using the mysql npm module, I can't use require because node returns me

require is not defined in ES module scope

So i just import the module as here:

import mysql from 'mysql';

And it works fine in nodemon, but when I try to implement the whole app using xampp local server I get this error:

The requested module '/weatherapp/node_modules/mysql/index.js' does not provide an export named 'default

I've already tried using required in all the posible implementations (Using define, the [mysql], funtion() sintax ...) and it won't work.

I'm using a dbGestion.js file in which I try to import the mysql module and then defining functions and exporting them to main.js, where all the code for the app is.

You can checkout everything i have here: Proyect

about 4 years ago · Juan Pablo Isaza
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