Node.js & less on Media Temple Grid

Maybe I’m crazy, but I wanted to install Node.js in a (gs) shared hosting environment so that I could compile and save small changes to my LESS-based stylesheets via SSH without having to maintain a local working copy. That’s right. I said it. I change files in a live environment sometimes, and there’s nothing wrong with that! Anyone who opines to the contrary in the comments below will be swiftly dealt with.

This how-to is based on the great work of Ian Tearle and his commenters.


Get your Media Temple Grid Service site number. If you don’t know your site number, see this Media Temple support page. For this tutorial, we’ll use the 123456 as an example.

First, let’s to prepare the shell environment to recognize executables in the new directories we’re going to create. Create or edit ~/.bash_profile and add the following lines:

export PATH

Save the file and exit, then source ~/.bash_profile to reflect the changes without logging out and back in:

$ . ~/.bash_profile

Building Node

Now let’s grab Node.js from GitHub:

$ git clone
$ cd node
$ mkdir -p /home/123456/data/opt
$ ./configure --prefix=/home/123456/data/opt/
$ make && make install

If all goes well (that make can take a while), you should now have a fully-functioning Node.js installation. Test it out by typing node -v. If you see a version number and not an error, you’re in business!

But wait! There’s less!

Now it’s time to download and install less.

$ cd ~/data/
$ npm update
$ npm install less

This will install the lessc binary in the ~/data/node_modules/.bin directory which we added to our $PATH. The installation may fail. If it does, just try running it again a few times until it works.

If all goes as well for you as it did for me, you should now be able to use lessc from anywhere within your jailed shell environment!


  • Tyler Smith says:

    I have several domains on my GS already running on php. I’m new’ish to node and am curious how I can get this running on only one domain and not effect the other sites I host.

  • Linuxtrek says:


    This should have /home/123456/data/opt/bin.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>