get-installed-path
get-installed-path copied to clipboard
Support environment variables in .npmrc's "prefix" setting
I traced the strange behavior of resolve-package
to a problem in this package:
My node code:
console.log(require.resolve("lodash"));
require("get-installed-path").getInstalledPath("lodash").then(null, console.log);
Output:
/mnt/…/nodejs/modules/lodash/lodash.js
Error: get-installed-path: module not found "lodash" in path /home/mk/${HOME}/lib/node_modules/lodash
at fs.stat (/mnt/basecamp/app-res/nodejs/modules/get-installed-path/dist/index.js:98:23)
at FSReqWrap.oncomplete (fs.js:152:21)
When I change the prefix
setting in my .npmrc
from ${HOME}
to ${HOME}/foobar
and copy my ~/.node_modules
symlink there, the error message adapts to
Error: get-installed-path: module not found "lodash" in path /home/mk/${HOME}/foobar/lib/node_modules/lodash
I wonder though, where does the /home/mk
come from if the ${HOME}
wasn't replaced?