doesn't support `$HOME/.node_modules` or `$HOME/.node_libraries`
See original GitHub issueHi, thanks for this module! It seems to have trouble finding my packages, though:
$ readlink -m ~/.node_modules
/mnt/…/nodejs/modules
$ nodejs -e 'console.log(require.resolve("lodash")); require("resolve")("lodash", console.log);'
/mnt/…/nodejs/modules/lodash/lodash.js
{ Error: Cannot find module 'lodash' from '.'
at /mnt/…/nodejs/modules/resolve/lib/async.js:50:31
at processDirs (/mnt/…/nodejs/modules/resolve/lib/async.js:184:39)
at ondir (/mnt/…/nodejs/modules/resolve/lib/async.js:199:13)
at load (/mnt/…/nodejs/modules/resolve/lib/async.js:82:43)
at onex (/mnt/…/nodejs/modules/resolve/lib/async.js:107:17)
at /mnt/…/nodejs/modules/resolve/lib/async.js:12:69
at FSReqWrap.oncomplete (fs.js:152:21) code: 'MODULE_NOT_FOUND' }
So require.resolve
was able to find it, but resolve
wasn’t. However, it works when I create a symlink /mnt/…/nodejs/node_modules
to modules
.
Update: Work-around: It also works when I pass option { paths: [process.env.HOME + "/.node_modules"] }
Update 2: However, in that case I have to then explicitly resolve the returned path in order to get the exact same result.
Issue Analytics
- State:
- Created 5 years ago
- Comments:30 (16 by maintainers)
Top Results From Across the Web
npm install doesn't create node_modules directory
NPM has created a node_modules directory at '/home/jasonshark/' path. ... installs package & creates the node modules directory.
Read more >How To Use Node.js Modules with npm and package.json
The node_modules folder contains every installed dependency for your project. In most cases, you should not commit this folder into your version ...
Read more >The magic behind npm link - Medium
The “global node_modules” directory is a special directory where all modules installed with npm install -g are stored. You can find the path...
Read more >Npm install error(fails) - M220JS - MongoDB
npm WARN deprecated libnpmconfig@1.2.1: This module is not used ... npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\Home\ ...
Read more >npm
We're npm, Inc., the company behind the npm Registry and npm CLI. We offer those to the community for free, but our day...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The current workaround for this is to pass
[$HOME/.node_libraries, $HOME/.node_modules]
as thepaths
option.However, what I can provide, is to say I didn’t write anything about
NODE_PATHS
in the example repo. Alsogit grep -nFe NODE_PATH
came back empty, so it hasn’t crept in.