Connecting the photon using command prompt

Hello,

We have been able to connect our photon using the android particle app on other routers. However, my home router does not allow us to connect it using the app for some reason. We used to use the command prompt to set up the others but now it is not working. This is what I get:

eldoraranch3s-MacBook:~ eldoraranch3$ sudo npm install -g particle-cli
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js
/usr/local/lib
└── particle-cli@1.18.0 

eldoraranch3s-MacBook:~ eldoraranch3$ particle setup
Error loading command /usr/local/lib/node_modules/particle-cli/commands/SerialCommand.js Error: Module version mismatch. Expected 48, got 46.
 _ __             _   _      _        
| '_ \  __ _ _ __| |_(_) ___| | ___ 
| |_) |/ _` | '__| __| |/ __| |/ _ \
|  __/| (_| | |  | |_| | (__| |  __/
|_|    \__,_|_|   \__|_|\___|_|\___|
                 https://particle.io

> Setup is easy! Let's get started...
> It appears as though you are already logged in as eprphotontest@gmail.com
? Would you like to log in with a different account? No

! PROTIP: Hold the MODE/SETUP button on your device until it blinks blue!
! PROTIP: Please make sure you are connected to the internet. 

readline.js:982
            throw err;
            ^

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 switchChoice [as completed] (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:115:4)
    at 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/rx-lite/rx.lite.js:1550:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/rx-lite/rx.lite.js:1489:14)
    at Subject.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/rx-lite/rx.lite.js:5871:19)
    at Subject.tryCatcher (/usr/local/lib/node_modules/particle-cli/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.completed (/usr/local/lib/node_modules/particle-cli/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/rx-lite/rx.lite.js:1489:14)

Thanks in Advance

Could you try updating the package, or even re-installing it? Updating the underlying tools (Node & NPM) may have caused some discrepancies.

1 Like

I kept the node because I had just downloaded it again earlier. I used sudo npm install -g particle-cli and then sudo npm install -g particle-cli. It looks like it is working. Thanks!

Well…Now I have a new problem:

eldoraranch3s-MacBook:~ eldoraranch3$ particle setup
 _ __             _   _      _        
| '_ \  __ _ _ __| |_(_) ___| | ___ 
| |_) |/ _` | '__| __| |/ __| |/ _ \
|  __/| (_| | |  | |_| | (__| |  __/
|_|    \__,_|_|   \__|_|\___|_|\___|
                 https://particle.io

> Setup is easy! Let's get started...
> It appears as though you are already logged in as eprphotontest@gmail.com
? Would you like to log in with a different account? No

! PROTIP: Hold the MODE/SETUP button on your device until it blinks blue!
! PROTIP: Please make sure you are connected to the internet. 

> No devices detected via USB.
? Would you like to scan for nearby Photons in Wi-Fi setup mode? Yes

! PROTIP: Wireless setup of Photons works like a wizard!
! PROTIP: We will automagically change the Wi-Fi network to which your computer is connected.
! PROTIP: You will lose your connection to the internet periodically.

? Found "Photon-4V2K". Would you like to perform setup on this one now? Yes

! PROTIP: You will need to know the password for your Wi-Fi network (if any) to proceed.
! PROTIP: You can press ctrl + C to quit setup at any time.

> Obtained magical secure claim code.

! PROTIP: There was a network error while connecting to the cloud...
! PROTIP: We need an active internet connection to successfully complete setup.
! PROTIP: Are you currently connected to the internet? Please double-check and try again.

Personally I’ve never been too fond of the ‘setup’ command. If you’re willing, try configuring it over Serial with particle serial wifi. Once that’s connected, you can claim it using particle device add [aId]. The ID can be found with particle identify. Both the wifi and identify part should be done while in listening mode. Claiming it should (and can only) be done while it’s connected.