Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My question is: why can’t the Node installer add /usr/local/bin to the path itself (if needed)? Why force me to do it? The Windows installer did it for me. I can just type `node` or `deno` into PowerShell and it loads up a REPL. I never had to add them to `PATH`.


node puts relevant binaries into /usr/local/bin because that's just how you do things. Whether or not that path is in $PATH is none of node's business, and if you (for whatever weird reason) work on a system where that's not the case, you probably wouldn't want the node installer to mess with that.

Note that the installer is not saying "please make sure /lib/node.js/ is in $PATH" - this would certainly be something to expect the node.js-specific installer to set up by itself.


On what platform doesn't it? I've installed node on Windows and various flavours of Linux and I've never needed to extend $PATH for it. Is this a mac thing?


It expects /usr/local/bin/ to be on the $PATH, and so it adds itself to that location.

It doesn't know if you purposely meant to remove it's install location from the PATH, so it doesn't re-add it.

It could do what you ask, but this requires setting the $PATH. The most common way to do so is modifying bashrc, but now you're modifying the user's bashrc. Now you ask, is the user using bash? Maybe you're using the fancy whiz-bang ohmyzsh since that's what Medium told you to do, and now that doesn't work either.

If you keep /usr/local/bin on your $PATH (which is standard in most 'nix installations) then you don't have to change anything or do anything. Why do _you_ have such an abnormal system? We can play this game all day and it's fucking miserable. Just learn how to use your tools for fuck's sake.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: