CLI login throws err

When starting the particle cli via particle setup, then selecting login, it crashes with this:

            throw err;

TypeError: Cannot read property 'login' of undefined
    at SetupCommand.login (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:261:7)
    at PromptUI.completed (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:143:19)
    at PromptUI.onCompletion (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/lib/ui/prompt.js:69:10)

Any way to get around this bug?

Running Version 1.8.11, installed today.

I just lost 30 mins of coding because of the web ide, and now can’t start the cli. It’s a little frustrating.

Thanks in advance for any help!

Version 1.8.11 is not the current version of the CLI, it’s 1.28.1. It looks like you might have more than one version installed.

First try:

sudo npm uninstall -g particle-cli

and see if you can remove the old version that way.

If that fails, just remove the particle app. Do a:

which particle

and then remove that file, or maybe just rename it to something like particle-old.

Then reinstall the Mac/Linux Particle CLI using the CLI installer:

bash <( curl -sL )

The Mac/Linux CLI installer creates a separate copy of node for its own use so it won’t mess with your node configuration. Also, it no longer requires sudo. The side benefit of this is that it will ignore your current broken global (-g) particle-cli install as long as you call the correct one.

1 Like

Aha! Thank you rickkas7! You are correct, we were using an ancient version of the cli!

What worked was running the npm uninstall, then reinstalling with the curl url you mentioned. Then, adding to the path via:

echo $PATH
export PATH=$PATH:/Users/username/bin

Then, installing via npm again:

npm install -g particle-cli

And we have version 1.29.0! Thank you, can’t wait to start using this now!