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

194
Vistas
Can I import from node_modules of a module?

I'm not that great at JS/TS but I'm helping run a build system. I have a bit of code that was submitted, and I'm not sure if I should alter the build system or kick it back to the developer.

The code looks like this...

import * as googleAuth from "googleapis/node_modules/google-auth-library"

When I run yarn install the various modules are installed properly in ./node_modules/ including googleapis and google-auth-library. When I run yarn build I get something like this:

yarn run v1.19.1
$ rm -rf lib; ./node_modules/.bin/tsc -d -p tsconfig.npm.json
Error: src/foo/bar/common/oauth_helper.ts(3,29): error TS[23]: Cannot find module 'googleapis/node_modules/google-auth-library' or its corresponding type declarations.

When I test this out locally, I can make the error go away by doing cd ./node_modules/googleapis && yarn install but that installs a second set of all the modules needed there.

Is there something that I'm missing or should I tell the developer that he needs to import directly from goggle-auth-library. Furthermore if the developer is referencing this module explicitly I feel like he should list it as a dependency in package.json, not get it implicitly.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I would suggest to directly install google-auth-library instead of going through the node_modules of another package.

This might be risky because lets says in future googleapis package updates and for some reason removes dependency on google-auth-library this will break your app.

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