Ubuntu 12.10 Upgrade… OK Something Did Break

A week after I upgraded my laptop to Ubuntu 12.10 and I’ve found something that’s actually broken.

In 12.10, the node.js package has been moved from /usr/bin/node to /usr/bin/nodejs as it clashed with another package name (called, unsurprisingly, node).

This is actually documented in the release notes (but only for Ubuntu Server… not for Ubuntu Desktop): https://wiki.ubuntu.com/QuantalQuetzal/ReleaseNotes/UbuntuServer#Other

I had node.js installed in order to run lessc, the LESS compiler. And, because of various complications due to my installation, 12.10 broke this.

My lessc installation had put a script in my ~/bin directory which I was calling and its first line was:

#!/usr/bin/env node

I’m no script expert but I’ve learnt that this is a trick used when you want a script to run cross-platform and you can’t be certain of the absolute path to the interpreter required to run the script. By pointing the script at env and passing it the name of the executable you actually want to run the script, you get a level of indirection that gets you around having to know exactly where the specific interpreter is installed. Of course the problem here is that node isn’t called that any more so this has to be changed to

#!/usr/bin/env nodejs

And with that, things are back up & running again.

The obvious follow-up question is: is this MY fault, or Ubuntu’s?

lessc is distributed as a node.js package. As I had no previous experience with node.js packages, I remember that setting up lessc was a case of “do a web search & follow the instructions”. The instructions I found mentioned that the Ubuntu repositories for 12.04 contained lessc 1.2 and the current version was 1.3. The recommended solution was to install lessc by installing node.js first and then using the node package manager, npm – which is what I did. As a result, my lessc installation is outside Ubuntu’s package control and didn’t get upgraded in sync with node.js when I upgraded to 12.10.

I see here that Ubuntu 12.10 now comes with lessc 1.3. Maybe the better solution is to uninstall the npm version of lessc and install the official Ubuntu one. Look, the changelog even specifically mentions that it’s been modified to work with the moved node.js: https://launchpad.net/ubuntu/+source/less.js/1.3.0~20120310-4 says:

* Update patch 2001 to rename node to nodejs also in Makefile, and in test outcome.
 Closes: bug#688030. Thanks to James Page.

Rather than break my (now working) lessc installation in an effort to check this, I installed lessc through apt-get on a 12.10 virtual machine. And yay – it works out of the box. The installation automatically installs node-js & a couple of other dependencies then it installs lessc into /usr/bin and the first line of the script is


i.e. because this is an Ubuntu specific build, it can directly reference where it knows nodejs is installed, whereas the generic npm-installed script has to indirect its reference via /usr/bin/env – and fails when Ubuntu changes node.js’ name.

So, I think I can call that about 50% my fault (for installing it by hand in the first place), 50% Ubuntu’s fault (for being a version behind and for renaming the damn thing). Most importantly it’s now working again and new installs won’t have to go through this pain.


Comments are closed to reduce the spam. If you'd like to add something, please use the contact form to let me know and I'll reopen comments for you. Thanks