Installing particle-cli & spark-server on raspberry pi 2

There have already been several sets of instructions for this, but none worked for me.
In case you got stuck like I did for awhile, this is what worked for me

first install fresh image raspberry pi wheezy firmware downloaded from
fire it up and change your password!

cd ~

sudo apt-get update && sudo apt-get upgrade

sudo apt-get install dh-autoreconf build-essential git-core  htop rng-tools libusb-1.0.0-dev

sudo modprobe bcm2708-rng

cd /tmp
sudo git clone
cd node
git checkout v0.12.4
./configure --without-snapshot
{takes a couple of hours}
node --v
npm --v

cd ~

sudo wget
sudo tar -zxvf dfu-util-0.8.tar.gz dfu-util-0.8
cd dfu-util-0.8/
sudo make install

sudo npm install -g serialport@1.5.0
sudo npm install -g serialport@1.5.0 particle-cli
particle cloud login

cd ~

sudo git clone
cd spark-server
sudo npm install
sudo node main.js

Good luck!

I’ve also found you can also compile and flash from raspberry pi 2 comfortably
(earlier models probably too slow)
*****to add repository for gcc-arm-none-eabi to raspberry pi:
pi@raspberrypi ~ $ sudo nano /etc/apt/sources.list
then add line below:
deb jessie main contrib non-free rpi
sudo apt-get update {DO NOT enter sudo apt-get upgrade! or you’ll be very sorry,
because A LOT of other stuff will get “upgraded” to untested versions}
sudo apt-get install gcc-arm-none-eabi
{I wanted 4.9.2 , but got 4.8.4 20141219, still seems to work for master & dev branch!}
You SHOULD comment out the line you added earlier,
"deb jessie main contrib non-free rpi"
in /etc/apt/sources.list after you install gcc-arm-none-eabi to prevent future unwanted changes
cd ~
git clone
cd firmware
git checkout develop
git pull
cd main
sudo make all PLATFORM=core APP=whatever_your_app_is_called program-dfu v=1

also works with master branch, but doesn’t work with v0.4.2 unfortunately;
v0.4.2 and photon probably require the newer arm-none-eabi-gcc
Anybody that can get arm-none-eabi-gcc 4.9.2 installed on rpi1 let me know!


Thanks BPR. This was really helpful. I found that the particle CLI install could be sped up a bit by using the code from adafruit’s post on installing node on a pi

sudo apt-get update
curl -sLS | sudo bash
sudo apt-get install node
sudo npm install -g serialport@1.5.0
sudo npm install -g serialport@1.5.0 particle-cli

Also this seems to work though I have not tried to compile anything on my photon yet using it.

sudo apt-get install dfu-util

Wow ! Thank you so much. I’ve been struggling to get Particle CLI working on my Raspberry Pi B+, for quite some time now. Following these instructions to the letter got it working.

One mistake that I kept doing was to do:

sudo npm install -g serialport@150

and then run:

sudo npm install -g particle-cli

and NOT

sudo npm install -g serialport@1.5.0 particle-cli

Doing this made it fail with a bunch of errors relating to serialport@174 on my Pi.

For anyone else out there…make sure you run the commands as posted initially and everything will be fine.

Thank you again !

1 Like

@cdrodriguez, yes the Adafruit link is quite helpful to get node v0.12.6 . Thanks for that! I’ve also found on the newest wheezy distribution that my previous steps failed to install particle-cli. What I then had to do is git clone the particle-cli repository to a folder on my pi 2, go into package.json and change the version listed for serialport from "serialport": "^2.0.1", to "serialport": "1.5.0",
and then run sudo npm install -g in the terminal from that folder to get it all to install without error.

Hi. I’ve been following these instructions and they’ve gone well for the most part, but when I get to installing the serial port, it goes straight into the tank. I get a ton of errors culminating in:

Failed at the serialport@1.5.0 install script ‘node-pre-gyp install --fallback-to-build’.

I noticed if I do “npm i serialport” (I ran into the command when trying to find the solution to the above) it comes back with 3.1.1. But if I use that number instead of 1.5.0, I still get the same errors. Can someone point a newbie in the right direction? Thanks!

@justkelly try Particle CLI on Raspberry Pi?

1 Like

That did it. Thanks!