Cannot find module 'particle-usb'

photon
Tags: #<Tag:0x00007fe2201f1300>

#1

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.

#2

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?


#3

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!


#4

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?


#5

@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.


#6

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.


#7

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


#8

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.


#9

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>