How to install spark-cli on Ubuntu 12.04

Do not install nodejs or npm from the standard repositories. If you have done so, or you are uncertain, first uninstall

$ sudo apt-get remove nodejs npm
$ sudo apt-get purge nodejs npm
$ sudo apt-get autoremove 

Install nodejs from the Chris Lea repository. You’ll need g++

$ sudo apt-get install python-software-properties python g++ make
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs

Do NOT explicitly install npm. If you do so the incompatible npm from the standard Ubuntu repositories will be installed. The nodejs package in the Chris Lea repository contains a later version of npm. Now you can

$ sudo npm -g install spark-cli
$ spark



Thank you for these instructions! I’ll test them out and add to the installation docs when I get a chance!

Thanks for this!

What is special about chris’ repo that the ubuntu repo is missing?


yes i'd like to know this, you can't just recommend a random PPA without reasoning.

on debian7 the standard npm/nodejs works fine, which i assume are the packages that ubuntu re-used. the only thing i had to do was symlink /usr/bin/nodejs to /usr/bin/node


@inof8or: The special thing about the Chris PPA is that it contains nodejs code that works with Spark CLI. Also it is the only version of nodejs with the NSA callback. [OK, for the avoidance of doubt, that’s a joke - the standard version also contains the NSA callback.]

The standard Ubuntu modejs package did not work with Spark-CLI. They installed, but did not work. I also tried linking node to nodejs. I tried hard to make them work, but they did not. The version available back then (and now, I just checked) from the std repos was 0.6. This version is known to be flaky. The Chris repo version of nodejs is 0.10 - the version also available in Ubuntu 14.04 and, we are led to believe, in Debian.

@sej7278: I too am concerned about adding random PPA’s to my repo list. I did a Google search. Several people were recommending the Chris PPA for a working nodejs in general - not Spark CLI specifically.

I refuse to add “you do this at your own risk” disclaimers every rare time I give a little useful (or useless) (or outright dangerous) piece of advice. In my world the grass is always assumed slippery when wet - no need for the park keeper to put out the warning signs. But you are correct to be wary.

Please, if anyone has found that the standard install of Ubuntu 12.04 nodejs (i.e. 0.6) actually works with Spark CLI just say!

1 Like

ah my debian install is jessie/sid, so has a newer node than a standard ubuntu 12.04, you have to use saucy salamander or later for 0.10 (whatever number that is, 12.10 or something perhaps, stupid ubuntu names!)

$ nodejs --version

Joyent (creators of node) themselves recommend installing from the Chris PPA for the latest version.

See this page:

It is true that newer Ubuntu versions include the 10.x versions, but the PPA is quicker to update. If you have a new version of Ubuntu, its up to you if you care to use the ppa or not.

1 Like


I have shifted this under Tutorials category before accepting the PR.


1 Like

Would recommend bookmarking this to anyone planning to upgrade their distro. Just switched to Mint 17, and still need chris’ ppa.

Know the few commands posted here to get up and working seem simple, but picture folks upgrading their systems every 6 months or so and forgetting to install because of minor complexity. Honestly when talking to people about odd 3rd party repo package installs they talk about security, but I think they are more worried about convenience of having a package that is easy to keep track of and recommend to the uninitiated. The later being important for the growth of the platform.

Just my 2 cents, the spark team might want to identify a way to wrap this into one package that gets tracked by the main repos. Ardiuno has one, but I noticed it lags behind in version significantly, is there an inherent problem on that side of things that makes it slow / hard?


I would love any way to make the cli easier to install and easily keep up to date,

I created an issue for that here:

I’m not super familiar with this myself, so I would appreciate any help! :smile:


1 Like

For whatever reason, the big distros are very, very slow to update Node.JS even though updates are frequent. Up until recently, Ubuntu was stuck on something like 0.6.X even though 0.10.X has been available for quite a while. They didn’t get it caught up until 14.04. Node.Js is a pretty popular language, so I don’t understand the lag either. I’ve just taken to cloning the GitHub repo and compiling straight from source. It takes longer, but there aren’t any dependencies (other than build-essential, make, gcc, etc) to hamper a straight ./configure && make && make install. If you’re on a slower machine (like a Raspberry Pi), I recommend compiling in a screen session!

1 Like

that's bizarre, isn't mint just an ubuntu ripoff, itself a debian ripoff?

debian wheezy/jessie and ubuntu trusty/utopic are at 0.10.25 - 0.10.29

Not quite a “ripoff”. The comes a time in a young distro’s life where it seeks to differentiate itself from its parents. haha

I think Mint is now only using LTS releases as upstream. That might be hearsay though, I’m just a user.

@wgbartley There must be a really onerous process with packaging, I remember when GIMP 2.8 came out it took more then one release cycle (8+months) to get into repositories. Like I said before, currently Arduino is multiple releases behind.

1 Like

Thanks for these instructions. Currently trying to run on virtualbox, and getting the following error when I run ‘spark setup’:

Serial err: Error: Cannot open /dev/ttyACM0
Serial problems, please reconnect the core.
Something went wrong Serial problems, please reconnect the core.
Press and hold the MODE button until your core blinks solid blue

As far as I can see, I have conneted the Spark core USB device into the virtual box on ttyACM0 - thats what it shows up as when you run dmesg.

Any advice/experience with using Spark-cli in a virtual box would be appriciated - I have really struggled with getting it going in Windows (havent managed to get this working at all) - and dont have an android device.


EDIT: …I should have added that I am running mint-16 in the virtualbox.

I used the installation script from NodeSource to install Node.js on Ubuntu 12.04. It explicitly removes ppa:chris-lea/node.js. NodeSource supports more distributions than a PPA could.