Last Updated: February 25, 2016
· dmichaelavila

Run node programs without installing them globally

Like everyone else, I'm using more node programs these days. I don't always like to install these dependencies globally, but I haven't had a way to avoid this. Recently I learned this simple trick from @mwynholds: prepend node_modules/.bin to your path. Something like this:


You can test this with the following (assuming you have node/npm installed and on your path):

$ echo 'PATH=node_modules/.bin:$PATH' >> ~/.profile
$ source ~/.profile
$ cd /tmp
$ npm install grunt-cli
$ type grunt
grunt is node_modules/.bin/grunt


  • These programs will only be on your path when you're at the root of your project (or whatever directory contains your node_modules/)

  • For dependencies you use a lot (like coffee-script for me), you'd have many duplicate installations. It seems reasonable to install these globally.

Overall this has been an improvement to my workflow. Any other options out there?

Say Thanks