Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

551
Views
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 answers
Answer question

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 Report

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!