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

545
Visualizações
cannot find module 'axios' after bundling with parcel

I am building a server side rendered website after i built the api for it.

Now, I am getting this error cannot find module 'axios' when importing axios in a js module and bundling it using parcel 2.0.1. Parcel and axios are both installed as dependencies and axios is installed as a dev dependency as well, and it is in the node modules.

Before I installed parcel and when I imported the js file into the html pug file, axios worked fine (it did the fetching as expected), but only when I tried to bundle it that it started giving me this error. enter image description here

enter image description here

enter image description here

enter image description here

Any help is appreciated, thank you.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

In the closest (from the root of project directory) package.json file, add or update "type" field with a value of "module". It will ensure that all your .js, .ts and .mjs files are interpreted as ES modules.

...
{
  ...
  "type": "module"
  ...
}
...
about 4 years ago · Juan Pablo Isaza Relatório

0

axios should install as dependencies, not dev dependency.please try it.

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