Particle CLI not working


#1

I used the links on the particle website to create the command line for my particle electron, but I was unable to run anything on the command line. Below is one example of the error that keeps on approaching when I try to run anything with the particle command.


#2

First, see if it installed correctly:

~/bin/particle login

If that doesn’t give a command not found error, then you just need to fix your PATH.

The .profile file in your home directory should have this in it (usually at the end):

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

If not, you should add it. Then reload it.

source ~/.profile

That should fix the problem, unless you are using an alternate shell like zsh.


#3

I can’t get the CLI to work on Mac OS Mojave. I’ve installed it using the curl command in the docs, and I got the welcome message. I see the particle executable in ~/bin. Trying to login from that directory, I get
"-bash: particle: command not found"

rics-iMac:bin ricdelmar$ pwd
/Users/ricdelmar/bin
rics-iMac:bin ricdelmar$ ls
particle
rics-iMac:bin ricdelmar$ particle login
-bash: particle: command not found


#4

If you are in the bin directory you probably will need to use ./particle login to use the particle command in the current directory.


#6

Thanks, that worked. I was unaware that you couldn’t run an app from the directory it’s in without that. I fixed my PATH variable using the instructions you wrote above, and now it works from my home directory.

I don’t know why this has to be so difficult. I tried to install it with “npm install -g particle-cli”, and all the fixes (some that worked before) in this post, but they all gave me many errors. I’ll probably be back the next time I need to update the CLI to the latest version because that always goes badly. Unless there is a new, better way to update, I assume I’ll run into the same problems next time.


#7

Definitely don’t use the npm update command on the Mac if you’ve use the CLI installer bash command, instead just do:

particle update-cli