-
Notifications
You must be signed in to change notification settings - Fork 3k
Should I add ~/node_modules/.bin to my $PATH #957
Comments
You can add whatever folder to your path that you like :) Of course, then it'll only work if you do a local install in ~. If you're in some other folder, it won't put the bin in ~/node_modules. But, you could put |
I know this is an old ticket, but it shows up on google for "npm which PATH", so I thought I'd leave my work around here. This only works on sh, bash, zsh (pretty much any shell that uses https://gist.github.com/airtonix/9925531 disclaimer: it's ugly, but it makes using |
Another solution is to use the "scripts": {
"gulp": "npm run gulp"
} Then you can
You can still pass arguments too:
No more global installs evar. |
A cleaner solution, as someone pointed out in stack overflow is to simply update your path as,
This limits you to finding the binaries only while running commands from a project root directory (or the same parent folder as node_modules) but it seems better than other solutions that involve running script on PROMPT_COMMAND, etc. |
No. You should use either nvm or nodist. If you're using nvm then you should be using autoenv. Don't mess with your path at runtime, is not reproducible, not robust and On Fri, 20 May 2016, 07:10 shyam-habarakada notifications@github.com
|
Another reason not to modify your path like that is that a broken (or even malicious) package can overwrite a system command and lead to problems that can be very difficult to debug. Example: isaacs/node-touch#8 If you must add export PATH="$PATH:./node_modules/.bin" |
For WindowsStore the following in a file called @echo off UsageThen you can use it like |
@greypants seems like you will end up with undefinite loop here. Shouldn't this be:
? |
local as default is really frustrating, just wondering if adding ~/node_modules/.bin to my path would fix me having to use -g EVERY time i install a module that comes with a commandline tool?
The text was updated successfully, but these errors were encountered: