Cannot find module 'particle-usb'

photon
Tags: #<Tag:0x00007fe21e325b60>

#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>

#10

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.


#11

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.


#12

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


#13

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.


#14

Oh ok thanks for your help


#15

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


#16

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


#17

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