[SOLVED] CLI defect? Cannot read property 'findDevices' of undefined


#1

Mod edit (@harrisonhjones): Solution: Reinstall the Particle CLI

I just updated to latest npm (3.10.10) and node (7.3.0) and it’s now impossible to configure my Photon’s. Running “particle setup” and accepting the logged in users produces this crash:

TypeError: Cannot read property 'findDevices' of undefined
    at SetupCommand.findDevice (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:293:8)
    at accountStatus (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:150:3)
    at module.exports.switchChoice [as completed] (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:115:4)
    at module.exports.PromptUI.onCompletion (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/lib/ui/prompt.js:57:10)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:1550:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:1489:14)
    at Subject.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:5871:19)
    at Subject.tryCatcher (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.completed (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:5796:56)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:1489:14)

The Particle mobile app is still not updated, so it’s also of no use. Any suggestions?


#2

Updating version Version 1.17.0 didn’t work and I got an error regarding the serialport dependency that wasn’t compiled for my version of node. It was also impossible to uninstall it, so I just deleted the node-module and reinstalled. Reinstalling fixed the dependency and gave me Version 1.18.0 of particle-cli.


#3

When updating Node it’s always a good idea to reinstall/update the CLI, though it really shouldn’t become unusable.
What exactly is wrong with the mobile app though?


#4

The mobile app has not worked for several months now, ref this thread: Official Particle Android app is unable to see new Photon's

The app is completely unable to see Photon’s and it also fails for my custom PCB’s based on P1 modules. It’s kind of cumbersome to say the least that I have to add a USB port to my designs just to be able to set wifi credentials…


#5

It looks like the findDevices call is failing because the CLI is failing to load the serial module.

Sounds like a failed install to me. I suggest you try completely uninstalling the CLI with npm uninstall and then reinstall it.


#6

Hi Harrison,
Yeah. That’s what I did and it worked :smile: