Particle CLI cannot find node on Mac High Sierra

After an update of the particle CLI …

Am Getting a message that " The Particle CLI requires Node >=4.4"

How do I update Node JS?

I updates node js using this command

brew upgrade node

Error: node 10.9.0 already installed

So it seems node is installed but the particle cli can’t find node.

Do I have to modify the PATH ?

Regards
ChipMonk

On High Sierra in particular, it’s best to use the Particle CLI installer which installs its own isolated version of node and runs as regular user, not superuser.

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. It’s currently 1.33.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
2 Likes

Rick,

this worked. I removed the old cli and re-installed the cli. This still did not work in a fresh terminal so I checked the PATH and added the new particle to my PATH.

particle cli now works and

particle --version returns 1.33.0

so I am good now.

Thank you for the detailed reply.
ChipMonk

2 Likes