1

The postinstall stage for my package.json uses tsc. I'd like to make it so such a global dependency is never expected of the user, and the solution is to replace it with ./node_modules/typescript/bin/tsc.

Unfortunately, this only works if node_modules is a subfolder of the one I'm currently in. So what I would like to do is use some form of env variable which probably exists but I can not find to do this:

$ROOT_NODE_PACKAGE/node_modules/typescript/bin/tsc $CURRENTLY_INSTALLING_PACKAGE

How do I do this?

Seph Reed
  • 8,797
  • 11
  • 60
  • 125
  • 1
    The documentation says "Since the module lookups using `node_modules` folders are all relative, and based on the real path of the files making the calls to `require()`, the packages themselves can be anywhere.", I think this technique would work, no? https://stackoverflow.com/a/12239689/3196753 – tresf Mar 05 '18 at 23:22

0 Answers0