From: http://bocribbz.com/post/80417240179/nodejs-in-pythons-virtualenv
Virtualenv is very useful tool, it helps with isolation and solves some redundant administrative works. Node.js also has similar tools, but from them, one stands apart, nodeenv.
What is really great about nodeenv, is that it helps you avoid typing long source commands, and if you are used to virtualenvwrapper, you dont have to learn a new set of commands.
To install it you can follow these quick steps, after you have installed virtualenv and virtualenvwrapper.
$ mkvirtualenv node_proj
(node_proj)$ pip install nodeenv # install nodeenv in the py virtualenv
(node_proj)$ nodeenv -p # install nodejs and add new function to virtualenvwrapper
* Install node.js (0.10.26) ... done.
* Appending nodeenv settings to /opt/node_proj/shared/env/node_proj/bin/activate
(node_proj)$ deactivate; workon node_proj # reactivate to use the new functions
You now have a nodejs and a python isolated environment, and when you run npm install -g commands, it installs the packages in the node virtual env.