Cannot find module 'particle-usb'

Particle Photon. I have Particle Workbench installed on two computers. On one I can flash fine via USB. On the other I get the verbiage below. I’ve tried re-installing the CLI and even VS Code, no luck. I’d be grateful for any suggestions, thanks.

> Executing task: make -f 'C:\Users\XXX\.particle\toolchains\buildscripts\1.6.1\Makefile'  flash-user -s <
Cannot find module 'particle-usb'
make: *** [C:\Users\XXX\.particle\toolchains\buildscripts\1.6.1\Makefile:23: dfu] Error 1
The terminal process terminated with exit code: 2

Press any key to close the terminal.

What OS are you running?
If Windows, try the driver installer and make sure to tick the “remove old drivers” checkbox too.

Does CLI (executed via CMD or powershell) also report that issue?

Thanks for your response.

Using Windows.

Running the driver installer (with remove old drivers) did not fix - continue to get same error.

Flashing from CLI seems to work,

particle flash --usb tinker

returns

Flash Success!

1 Like

Can you run Particle: Audit Environment and check if you get any "ok": "false" entries?

Maybe @m_m can also chime in here.

BTW, what device OS version have you got running on your device and what are you targeting?

@ScruffR @occamman yeah, CLI updates can be a bit hit or miss at the moment. you can usually gets things back on track by manually updating - try this:

  1. open VSCode
  2. run the Particle: Update CLI command

…share the log output it produces here.

1 Like

I ran Particle: Audit Environment, and all "ok"s are true.

1.2.1 is running on the device, and is set as the target.

I ran Particle: Audit Environment, output is:
particle update-cli
Updating CLI… no plugins to update.
PS C:\Users\XXX\Source\Repos\BedJitterTest\BedJitterTest>

I ran Particle: Audit Environment

i think you meant Particle: Update CLI - i assume you are still hitting the Cannot find module 'particle-usb' error?

if so, you can try the following:

  1. open VSCode
  2. open windows file explorer
  3. enter %appdata% into the address bar and press the <enter> key
  4. click into the "Local > particle" folder
  5. select the node_modules and .npm-cache folders, right-click > "Delete"
  6. go back to VSCode and run the Particle: Update CLI command

at this point you should see the CLI dependencies be reinstalled (log will show particle: Installing plugins..., it'll take a bit for the process to finish). once that completes, try running:

particle login

...follow the prompts and sign-in. then:

particle usb dfu

...confirm your device enters dfu-mode (flashing yellow). then:

particle usb reset

...confirm your device restarts and reconnects to the cloud (breathes cyan).

if you run into errors, please share them here along with the step where you hit the error.

Sorry for the delay. No joy:

> Successfully completed login!
PS C:\Users\ZZZ\Source\Repos\XXX\YYY> particle usb dfu
! Please reinstall the CLI again using npm install -g particle-cli
Cannot find module 'particle-usb'
PS C:\Users\ZZZ\Source\Repos\XXX\YYY> npm install -g particle-cli
C:\Users\ZZZ\AppData\Roaming\npm\particle -> C:\Users\ZZZ\AppData\Roaming\npm\node_modules\particle-cli\dist\index.js

> @serialport/bindings@2.0.7 install C:\Users\ZZZ\AppData\Roaming\npm\node_modules\particle-cli\node_modules\@serialport\bindings
> prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild


> spawn-sync@1.0.15 postinstall C:\Users\ZZZ\AppData\Roaming\npm\node_modules\particle-cli\node_modules\spawn-sync
> node postinstall

+ particle-cli@1.43.3
added 1208 packages from 1250 contributors in 83.521s
PS C:\Users\ZZZ\Source\Repos\XXX\YYY> particle usb dfu
! Please reinstall the CLI again using npm install -g particle-cli
Cannot find module 'particle-usb'
PS C:\Users\ZZZ\Source\Repos\XXX\YYY> npm install -g particle-cli
C:\Users\ZZZ\AppData\Roaming\npm\particle -> C:\Users\ZZZ\AppData\Roaming\npm\node_modules\particle-cli\dist\index.js
+ particle-cli@1.43.3
updated 1 package in 8.322s
PS C:\Users\ZZZ\Source\Repos\XXX\YYY> particle usb dfu
! Please reinstall the CLI again using npm install -g particle-cli
Cannot find module 'particle-usb'
PS C:\Users\ZZZ\Source\Repos\XXX\YYY> particle usb reset
! Please reinstall the CLI again using npm install -g particle-cli
Cannot find module 'particle-usb'
PS C:\Users\ZZZ\Source\Repos\XXX\YYY>

any luck with this? I am getting same problem. I am trying to use the command ‘particle usb list’. and I get this as a output.

I have tried reinstalling cli but no luck.

1 Like

What is particle --version telling you?
What OS?
Have you tried uninstalling/reinstalling CLI?
On Windows npm is not meant to be used to update CLI, rather use particle update-cli.
You may have multiple instances of CLI installed, make sure to only have one on your machine.

I am using mac OS, running 1.43.3. How do I delete the old instances?

I see - since the OP obviously is on Windows and you inidicated the same problem I just assumed Windows.

I’m not versed with MacOS tho’.
However, npm uninstall -g particle-cli should work on Mac too.

Oh ok thanks for your help

Is there a fix to this I am getting same error, My guess it it may be Windows Administrative Rights issue.

I had a problem with two nodes being installed. Had to delete one and then did a npm uninstall.

Yes, so Checking for two nodejs in Control Panel -> Program features- Nodejs 8.11 click on uninstall and then open command line to check if npm --version or node --version gets a response. Hopefully, that would solve it also gcc-arm I have two versions 5.13 and 6.1 so perhaps that may be causing it as well. Thanks

1 Like
  1. van a disco local c, usuarios, luego a su usuario
    2.activan mostrar archivos ocultos
  2. van a la caperta app data
    4.Eliminan la carpeta llamada particle
    5.van a panel de control y eliminan node.js si lo tienen si no saltan este paso
  3. abren visual studio
    7.oprimen cntrl+shift(arriba del ctrol)+p
    8.escriben particle:update
  4. les aparecera una pestaña en el visual studio en la que orpimen clean
    10.cierran y vuelven abrir y listo
    11.luego activan el modo dfu para flashear el particle por cable al oprimir los botones de setup y reset despues de dos segundos sueltan el reset
    y mantienen oprimido el setup hasta que el led quede en amarillo
  5. escriben particle:compile
    13.escriben particle:flash(local)
    y listo les debe aparecer done y flash succesfull