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

558
Views
Resolving module not found with Webpack (Module not found: Error: Can't resolve 'axios' in )

I have a package A which has dependency on say, axios. Package A builds independently and works fine. However, when I try to consume package A as a dependency in package B and try to compile, I am facing issue as below:

ERROR in ./node_modules/A/dist/impl/lifecycle-associate-tool-client-impl.js
Module not found: Error: Can't resolve 'axios' in '/workplace/LifeCycle/src/B/node_modules/A/dist/impl'
 @ ./node_modules/A/dist/impl/lifecycle-associate-tool-client-impl.js 17:32-48
 @ ./node_modules/A/dist/lifecycle-client-factory.js
 @ ./node_modules/A/dist/index.js
 @ ./src/api-clients/lifecycles/lifecycles.module.ts
 @ ./src/application.ts

In node_modules folder at the src level of package B, I have package A and inside of package A's node_modules, I have axios.

What I am aware of is that NPM resolves dependencies by looking at node_modules directory and then looking at parent if not found. But how to resolve this inward dependency situation?

Could webpack help to resolve the axios dependency by providing path in the resolve module to look axios in the node_modules, like below?

resolve: {
    alias: {
      src: path.resolve(__dirname, "..", "src"),
    },
    modules: [path.resolve(__dirname, "..", 'src'), 'node_modules'],
    extensions: [".js", ".jsx", ".ts", ".tsx", ".json"],
  }

I don't want to specify axios as dependency in package.json of package B.

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