See http://stackoverflow.com/questions/10081293/install-npm-into-home-directory-with-distribution-nodejs-package-ubuntu for the followings, which basically mean I can
npm install -g without worrying anymore:
export NPM_PACKAGES="$HOME/.npm-packages" export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
And then I use:
./node_modules/.bin which is a relative PATH entry, which is normally not recommended… but allows you to use tools (
mocha, ..) installed by
npm when running from the root directory of a package. Totally worth it.
I use n to manage node versions.