Installing Node.js and npm into a Python Virtualenv

With things like LESS and RequireJS, we’re starting to use Node.js’s npm (think pip for JavaScript) on every other project. However, installing Node.js globally means some dependencies are also installed globally, which might be a problem if different projects use different versions of the same packages. One solution is to install Node.js/npm inside your virtualenv, so here are the steps to get there:

First off, activate your virtualenv, and:

$ curl http://nodejs.org/dist/node-latest.tar.gz | tar xvz
$ cd node-v*
$ ./configure --prefix=$VIRTUAL_ENV
$ make install

That’s it! Now you can install npm packages directly to your virtualenv path with npm install -g {package}.

Recent Insights

Running your own Self-Hosted Etherpad Instance

Etherpad is an amazing real-time collaborative editor with a very low barrier for entry (no logins, …

Introduction to Django Selenium Testing

If you’ve never heard of Selenium, put simply, it’s a tool that allows you to create …

Introducing Amygdala, a JavaScript REST client

We’ve been working on a new UI and front-end architecture for our communication tool, Ginger. In …