I am working through the steps to build out a disconnected updater for remote Particle devices.
The first step is to get the Particle CLI running on the Raspberry Pi. I looked at the instructions on the docs site and tried the Linux approach. The installer completed successfully, but typing Particle at the command prompt gets the “command not found”.
I then looked on the forum and could only find this post from 2017
I know things change frequently with Raspberry Pi so, this did not seem like the best path forward.
So, does anyone have a set of instructions for getting the Particle CLI running on a Raspberry Pi?
Thank you. So, I think it would be helpful to detail the steps that would be needed for a customer with a new Raspian image. Here is what I have far:
Make sure you have the latest:
sudo apt update // See what is available
sudo apt full-upgrade. // Perform the upgrade
sudo apt clean // Free up space
Check to make sure you have Node and npm
node -v // should get a version response like v10.24.0
npm -v // should get a version response like 5.8.0
If you don’t get the responses listed, you need to install these
Assuming these work - then use your command
sudo npm install -g particle-cli // Test by typing "particle -v" at the command prompt - should get an information page
Here is the problem, I don’t think this is a complete install. When I put a Particle device into “listening mode” and connect it to the Raspberry Pi’s USB port, I get this error message.
The 'serialport' dependency is missing or invalid.
Please reinstall https://docs.particle.io/tutorials/developer-tools/cli/#installing
Cannot find module '@serialport/bindings'
so, I tried instruction on the particle docs page:
bash <( curl -sL https://particle.io/install-cli ) // Installed successfully - told me to uninstall using npm
npm uninstall -g particle-cli // Then closed and opened terminal window
particle -v // This worked
particle identify // failed with the same error 'serialport' message
This gets me right back to the same error I got before. So, I tried installing serialport…
sudo npm install -g serialport
Failed at the @firstname.lastname@example.org install script. It looks like it is failing in the prebuild step when installing node-gyp
So, I have the Particle CLI but I cannot us the Raspberry Pi to communicate with a Particle device over USB. I am a Raspberry novice so any help would be appreciated.
@nrobinson2000 - Great work! I have to agree with @chipmc that neopo solves the problem!. I hadn’t realized serialport wouldn’t get installed properly the other way (sudo npm install -g particle-cli) for reasons that are beyond me. @chipmc, if you also want just a stripped down particle-cli installer without all the great neopo goodies, here’s the commands (that could be scripted) to install the cli. (Tested twice this time, I promise, but only confirmed serial list, publish and monitor to be working):
pi@raspberrypi:~ $ mkdir -p particle-cli
pi@raspberrypi:~ $ cd particle-cli
#next we want to let npm install modules globally w/o needing sudo #see:Resolving EACCES permissions errors when installing packages globally | npm Docs
pi@raspberrypi:~/particle-cli $ mkdir ~/.npm-global
pi@raspberrypi:~/particle-cli $ npm config set prefix ‘~/.npm-global’
pi@raspberrypi:~/particle-cli $ sudo nano ~/.profile #Then add “export PATH=~/.npm-global/bin:$PATH” w/o the quotes to the end of ~/.profile then save file #Next configure npm to use new PATH
pi@raspberrypi:~/particle-cli $ source ~/.profile
So, I wanted to summarize in case anyone finds this thread in the future. Here is the net - net:
You can install the Particle CLI on the Raspberry Pi and do all the things you can do on a PC/Mac including flashing the device.
In this thread, three solutions were proposed but only two worked for me:
neopo - was the easiest and it provides benefits beyond the Particle CLI.
@bpr offered a step-by-step list of commands that also worked but required more time / patience
The instructions on the Particle docs allowed me to install the Particle CLI and log in. However, it did not provide any functionality that requires USB communications. Specifically, even though the Raspberry Pi is running Linux, the Linux instructions do not work. The manual process described in the docs also did not deliver full functionality.
@Colleen given that the Raspberry Pi is a popular device in the IOT / maker community, perhaps they could be updated to include one of these solutions.
Thanks @nrobinson2000 I think that’s a great idea that would benefit the Particle user base. Right now I have my tutorial docket full for the next couple of months or so (webhooks then workbench then Echo integrations) but will add neopo to the schedule!