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

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

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 Denunciar

0

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

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