Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

345
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda