Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package resolution algorithm doesn't work properly (nvm) #58

Open
maybephilipp opened this issue Dec 6, 2022 · 0 comments
Open

Package resolution algorithm doesn't work properly (nvm) #58

maybephilipp opened this issue Dec 6, 2022 · 0 comments

Comments

@maybephilipp
Copy link

maybephilipp commented Dec 6, 2022

In the beginning I want to say that I love your module and thank you for that!

The problem:

In case of nvm, node resolve function will resolve node's root node_modules if they're located not on top of the tree.

I've investigated your source code - it's just going up through parent dirs and checks for file existence, but nvm's global modules are located at $HOME/.nvm/versions/node/{version}/lib/node_modules.

So global modules or links are not found all the times.

Possible solutions:

  • Add an option to set additional search path (as require.resolve does)
  • Support node's root directory somehow (it's returned by npm root -g, so maybe there's a way to get it programmically).

Thank you:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant