What I Wanted to Do
I wanted to use
require to find the module I required, which could be in the globally installed location
What Happened Instead
module resolution doesn’t actually crawl through the global installation location
I’ve filed this issue against node, but haven’t gotten much traction. Unless I’m missing some historical context on why this is, it seems like at one point node would resolve to globally installed packages, but now it doesn’t because of where global modules are installed by npm.
$ npm --versions npm: '6.9.0', ares: '1.15.0', brotli: '1.0.7', cldr: '35.1', http_parser: '2.8.0', icu: '64.2', modules: '64', napi: '4', nghttp2: '1.34.0', node: '10.16.0', openssl: '1.1.1b', tz: '2019a', unicode: '12.1', uv: '1.28.0', v8: '6.8.275.32-node.52', zlib: '1.2.11' $ node -p process.platform darwin