Particle CLI Install - usb dependency problem - 404 error on github repository for node-usb

When attempting install of CLI (reinstall actually due to complaining about USB dependencies when trying to run particle mesh list), I get the following errors. It appears the USB library it is trying to download is throwing a 404 error?

Particle CLI version: 2.8.1
Node Version: 14.12.0
NPM Version: 6.14.8
Raspbian Stretch Linux

the usb library does not provide precompiled binaries for your platform (Raspbian Stretch Linux) and not one officially supported by the Particle CLI.

to get up and running, you’ll need to build libusb on the fly. in order to do that, you’ll need libudev - if you have apt, you can run sudo apt-get install build-essential libudev-dev. with those dependencies in place, you can simply re-run your npm i particle-cli -g command and things should start working.

for more info on the usb node library, see here: https://github.com/tessel/node-usb

Libudev-dev was installed successfully, redid npm install -g particle-cli and still getting the following error when running particle mesh list:

pi@raspberrypi:~ $ particle mesh list
! The `particle-usb` dependency is missing or invalid.
! Please reinstall: https://docs.particle.io/tutorials/developer-tools/cli/#installing
Could not locate the bindings file. Tried:
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/build/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/build/Debug/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/build/Release/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/out/Debug/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/Debug/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/out/Release/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/Release/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/build/default/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/compiled/12.16.1/linux/arm/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/addon-build/release/install-root/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/addon-build/debug/install-root/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/addon-build/default/install-root/usb_bindings.node
 → /home/pi/.particle/node_modules/particle-cli/node_modules/usb/lib/binding/node-v72-linux-arm/usb_bindings.node

Errors during install:

pi@raspberrypi:~ $ sudo npm install -g --unsafe-perm particle-cli
/usr/bin/particle -> /usr/lib/node_modules/particle-cli/dist/index.js

> usb@1.6.3 install /usr/lib/node_modules/particle-cli/node_modules/usb
> prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.5
prebuild-install info looking for cached prebuild @ /root/.npm/_prebuilds/cd9f6c-usb-v1.6.3-node-v83-linux-arm.tar.gz
prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v83-linux-arm.tar.gz
prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v83-linux-arm.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=14.12.0 runtime=node arch=arm libc= platform=linux)
make: Entering directory '/usr/lib/node_modules/particle-cli/node_modules/usb/build'
  CC(target) Release/obj.target/libusb/libusb/libusb/core.o
  CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
  CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
  CC(target) Release/obj.target/libusb/libusb/libusb/io.o
  CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
  CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
  AR(target) Release/obj.target/usb.a
  COPY Release/usb.a
  CXX(target) Release/obj.target/usb_bindings/src/node_usb.o
../src/node_usb.cc: In function ‘void handleHotplug(std::pair<libusb_device*, libusb_hotplug_event>)’:
../src/node_usb.cc:151:58: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
                                                          ^
In file included from ../src/helpers.h:3:0,
                 from ../src/node_usb.h:21,
                 from ../src/node_usb.cc:1:
../../nan/nan.h:1001:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
  CXX(target) Release/obj.target/usb_bindings/src/device.o
../src/device.cc: In static member function ‘static void Req::default_after(uv_work_t*)’:
../src/device.cc:237:64: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
    Nan::MakeCallback(device, Nan::New(baton->callback), 1, argv);
                                                                ^
In file included from ../src/helpers.h:3:0,
                 from ../src/node_usb.h:21,
                 from ../src/device.cc:1:
../../nan/nan.h:959:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
  CXX(target) Release/obj.target/usb_bindings/src/transfer.o
../src/transfer.cc: In function ‘void handleCompletion(Transfer*)’:
../src/transfer.cc:126:72: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
   Nan::MakeCallback(self->handle(), Nan::New(self->v8callback), 3, argv);
                                                                        ^
In file included from ../src/helpers.h:3:0,
                 from ../src/node_usb.h:21,
                 from ../src/transfer.cc:1:
../../nan/nan.h:959:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/usb_bindings.node
  COPY Release/usb_bindings.node
make: Leaving directory '/usr/lib/node_modules/particle-cli/node_modules/usb/build'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/particle-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

+ particle-cli@2.8.1
added 25 packages from 35 contributors and updated 1 package in 81.924s

hm. not sure what’s up. your best bet is to search for hints and / or report the issue over in https://github.com/tessel/node-usb

Hey @mjsco,

I’m pretty sure you need to install libusb-1.0-0-dev.

sudo apt install libusb-1.0-0-dev

If you’re interested in local building as well as using particle-cli I’d recommend trying neopo, a tool I developed that manages installation and usage of particle-cli and the necessary dependencies to build firmware locally on Linux, macOS, Windows, and Raspberry Pi.

You can install it with:

bash <(curl -sL neopo.xyz/install)

After installation you can access particle-cli with neopo particle. If you want you can use particle executable directly from ~/.neopo/particle.

Alright, so I did try each of the solutions above and definitely have more USB libraries on my pi now; however the problem remained when running

particle mesh list —> Errors

sudo particle mesh list —> No errors!

This is due to how it installs the binaries when installing as sudo vs as normal user - I did run into this problem before and it just took me a while to remember this.

So in summary - unless I am doing something wrong, I have found that you must run particle-cli as root on Raspbian OS…

You probably need to run the following to apply the udev rule that will allow non-root access to particle devices over usb provided you are in the plugdev group:

particle usb configure
1 Like