Particle-CLI Issues

Is there there a bug in the latest Particle CLI? I just installed this morning.

When I run:

particle serial monitor

I get:

Please reinstall the CLI again using npm install -g particle-cli
Cannot read property 'list' of undefined
Caught Interrupt.  Cleaning up.

Running Version 1.29.0

BTW: I just did a bunch of uninstalling and reinstalling of Node and NPM so I know I am current there.

@callen, are you running under Windows or Linux? If under Windows, I strongly recommend using the Windows CLI installer. On my Win 10 system, I removed nodejs and the particle install I had, cleaned up any directory associated with nodejs and particle and then installed CLI with the installer. The only thing I needed to do, which may or may not be fixed now, was to add the openssl directory to the windows path.

Oddly the latest CLI which I updated and used successfully last Friday won’t run today. I’ve uninstalled and reinstalled to no avail and I continue to throw this error on Win10:

C:\Users\JAmos>particle
C:\Users\JAmos\AppData\Roaming\npm\node_modules\particle-cli\node_modules\readable-stream\lib\_stream_writable.js:480
      asyncWrite(afterWrite, stream, state, finished, cb);
      ^

TypeError: asyncWrite is not a function

I had a similar CLI issue on Win10 last night as well.
I had not touched my photon in about a year, went to fix something, and no luck.
I reinstalled CLI, (without removing old one first) but no luck.
I reinstalled node.js, and also had to close cmd and open a new one.
Then it worked fine.

Still no joy… removed and reinstalled both node.js and CLI.

Same puke as before:

C:\Users\JAmos>particle
C:\Users\JAmos\AppData\Roaming\npm\node_modules\particle-cli\node_modules\readable-stream\lib\_stream_writable.js:480
      asyncWrite(afterWrite, stream, state, finished, cb);
      ^

TypeError: asyncWrite is not a function
    at onwrite (C:\Users\JAmos\AppData\Roaming\npm\node_modules\particle-cli\node_modules\readable-stream\lib\_stream_writable.js:480:7)
    etc...

Sorry I’m on Mac with the latest OS.

Same here. First time touching my photon to see if Particle had gotten better with documentation and then this. I don’t know why I struggle to make products. Everyone seems to be moving on quite well.

Oddly it ran Friday after npm update to v1.29.0… today however, this. No windows updates or other installs since then, either.

These instructions may help:

Particle CLI Repair

If you get an error during Particle CLI installation or upgrade, or if you upgrade and the version remains unchanged at a lower version number, you may need to follow these steps to fix your Particle Command Line Interface install.

Windows

  • Open a Command Prompt window and run the command:
npm uninstall -g particle-cli

If you get an error about npm not found, just continue onto the next step. This removes a previous manual install.

There are additional tips here.

To upgrade the CLI, use the command:

particle upgrade-cli

Mac or Linux

  • Open a Terminal window and run the command:
sudo npm uninstall -g particle-cli

If you get an error about npm not found, just continue onto the next step. This removes a previous manual install.

  • Reinstall the CLI using the Particle CLI installer for Mac or Linux:
bash <( curl -sL https://particle.io/install-cli )
  • Check the version of the installed CLI. At the time of writing (April 10, 2018) it was 1.29.0.
particle --version

Make sure you do not use the npm install -g particle-cli or npm update -g particle-cli command as this will break your installation again. Instead, use:

particle upgrade-cli

The main difference between the Particle CLI installer and the old way is that the new way runs a separate copy of node.js just for the CLI, and also installs as the current user, instead of root.

If you get an older version or particle command not found

Check and see which particle you’re finding:

which particle

If you get one in /usr/local/bin/particle, remove it:

sudo rm /usr/local/bin/particle

If you still get particle command not found

Try reloading your .profile:

source ~/.profile

If that still does not solve the problem, double check that this is near the end of your ~/.profile file:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
3 Likes

Hopefully this helps someone as I struggled with it for a couple hours. I was in a state where my installed CLI was not updated correctly and stopped working all together. Turns out removing all the dependencies and starting over fixed it.

I followed these steps to recover on my Mac:

  • Remove everything from the previous installation.
rm -rf ~/.particle
rm ~/bin/particle
  • Reinstall the Particle CLI per the instructions above.
bash <( curl -sL https://particle.io/install-cli )