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

Installing global package with yarn will not yield to a shim after rehash #194

Closed
lustremedia opened this issue Apr 13, 2022 · 2 comments
Closed

Comments

@lustremedia
Copy link

I have tried to install pm2 via yarn global add pm2 but I somehow cannot get pm2 to show up in bash no matter what I do.
nodenv rehash does nothing. I installed the rehash plugin that should run rehash automatically, no success.

Now when I install pm2 via npm install pm2 -g and then run a nodenv rehash I get a shim and it works.

Is this a bug?

@lustremedia
Copy link
Author

ok so I just found #120 after some more digging. The issue has been closed but it looks like this was more of a feature request.

Looks like yarn global is not supported out of the box, or has something changed since then?

@jasonkarns
Copy link
Member

jasonkarns commented May 27, 2024

Apologies for the delay. I'm going to close this but I would welcome any new information.

nodenv-rehash will create shims for anything that exists in $(nodenv root)/versions/*/bin/ (that is, the bin directories for each installed node). When npm installs a package globally, its executable ends up in that directory via symlink to $(nodenv root)/versions/*/lib/node_modules/<package>

It is my understanding that yarn operated the same way and added symlinks to the node's bin dir (which would make them discoverable by nodenv-rehash). If it can be confirmed how yarn did/does behave, we can reopen and dig further.

edit My recollection of yarn's behavior was wrong. It seems that yarn does not keep its global executables sequestered within the node version. (This makes sense when considering yarn itself has numerous installations mechanisms that place yarn itself outside the scope of node.)

I'm game to reopen a new issue to re-evaluate giving yarn first class support in nodenv. Though it will also have ramifications with corepack and others like pnpm.

@jasonkarns jasonkarns closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
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

2 participants