-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Doesn't seem to work with Homebrew #5
Comments
I'm happy to send a PR to that effect if you wish. |
Sure. PR welcome :) |
Coming late to the party; better late than never 🕺 😉 Just for sake of clarification:
So lets deep dive into this issue... Where is
|
solution by | result |
---|---|
boneskull | fails because global npmrc contains evaluated version of prefix = $(brew --prefix) 🚨 |
vladimyr | fails because /usr/local/lib/node_modules/npm/npmrc is harcoded i.e. brew prefix /usr/local is hardcoded/assumed 🚨 |
- what happens if homebrew changes contents of global
npmrc
file populated by node's formula postinstall step?
solution by | result |
---|---|
boneskull | fails because npmrc contents/prefix is hardcoded/assumed 🚨 |
vladimyr | still works because path to global npmrc is hardcoded instead ✅ |
As @boneskull concluded only reliable way to determine prefix in given scenario would require extra I/O but I firmly believe it is safe to assume that brew prefix is always set to /usr/local
. I'm eager to hear any possible counterarguments or examples where that assumption is not true.
PS Just for the record I instantly get sick when someone mentions installing node with homebrew (use nvm or n please 🙏); yet I just did it just to do this little research 🙃
Quoting myself:
Quoting from official homebrew installation docs
Explaning alternative installation methods (alternative prefix):
If homebrew authors are fine with here be dragons approach when using custom prefix I don't see why |
@vladimyr Thanks for the very thorough research. I agree we can just assume |
I guess PR #6 will fix this issue right? If not, is there anything I can help with? |
Probably but that's completely different pair of shoes from what I proposed here earlier... |
Fixed by #6 |
I'm not sure when this changed, but when installing
node
with Homebrew, thenpm.packages
directory is nonexistent:In fact, the npm prefix seems to be incorrect:
npm
lives in/usr/local/bin
, and thepackages
dir should be/usr/local/lib/node_modules
./usr/local/lib/node_modules/npm/npmrc
contains a prefix of/usr/local
.node
, OTOH, lives in/usr/local/bin
but is symlinked into/usr/local/Cellar/node...
.This means
global-dirs
can't reliably useprocess.execPath
to determine wherenpm
lives. However, the/usr/local/bin/node
symlink will be present inprocess.env._
in some shells. Perhapsglobal-dirs
should preferprocess.env._
overprocess.execPath
when present?references: boneskull/create-yo#1
The text was updated successfully, but these errors were encountered: