question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

doesn't support `$HOME/.node_modules` or `$HOME/.node_libraries`

See original GitHub issue

Hi, 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:closed
  • Created 5 years ago
  • Comments:30 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Jan 18, 2022

The current workaround for this is to pass [$HOME/.node_libraries, $HOME/.node_modules] as the paths option.

1reaction
mk-pmbcommented, Jan 12, 2022

However, what I can provide, is to say I didn’t write anything about NODE_PATHS in the example repo. Also git grep -nFe NODE_PATH came back empty, so it hasn’t crept in.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found