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

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

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 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!