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

553
Visualizações
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
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