Appium command not found

So I don’t have NVM, if I remember correctly I installed homebrew and then downloaded node from their site. When I run nvm -v zsh: command not found: nvm. If I do nano ~/.zshrc I see:


The bin appears to be linked, but I don’t understand how appium or appium doctor falls out of scope.
/Users/chaffe/.npm-global/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
If I run npm -v it returns the version, but doesn’t read appium commands.

Ok, can you uncomment the 2nd line in ~/.zshrc, the one that starts with:

# export PATH…

By uncommenting, I mean remove the number sign (#). Then run the command:

source ~/.zshrc

I think your Appium is installed here, can you confirm?

/Users/chaffe/.npm-global/lib/node_modules/appium/index.js

If so, I’d like you to try and link it to /usr/local/bin:

ln -s /Users/chaffe/.npm-global/lib/node_modules/appium/index.js /usr/local/bin/appium

It seems that with Appium 2 (at least on my machine) the file is index.js rather than main.js.

Good luck.

1 Like

@wreed firstly, thank you so much for spending so much time on this with me, you’re a saint and I hope you recover swiftly from Covid and wish you good health.

Secondly, I’m getting access denied on making the link. Do you know a alternative or way around that?
ln: /usr/local/bin/appium: Permission denied

Hmm. I would try ‘sudo’ in that case. Hopefully you have permission to use it.

sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium/index.js /usr/local/bin/appium

It should ask for your password and either do it, or it will say that you are not in the sudoers file.

If not in the sudoers file, you can try to install as I have with RVM. Mine is working out of the box. You want to install 14.16.1 Node (rvm install 14.16.1) and then you will want to update RPM (rpm update stable) and then install with rpm (rpm install -g appium). This is how I have installed and I’m having no problems.

What a hero, we now have appium! You might be able to help with this, if you wouldn’t mind… but appium-doctor doesn’t work either. Would sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/index.js /usr/local/bin/appium-doctor work? Because I tried it and then sourced the changes and zsh: permission denied: appium-doctor which is strange. Or should you link to appium-doctor.js?

Thank you!

On mine the symbolic link is to appium-doctor.js. So yours would be:

sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/appium-doctor.js /usr/local/bin/appium-doctor

I’m running the command, sourcing the change, but:
which appium-doctor
appium-doctor not found

the response to the link is: ln: /usr/local/bin/appium-doctor: File exists

Try:

ls -l /usr/local/bin/appium-doctor

What is that file and why is it there if you can’t call it after adding /usr/local/bin/ to your $PATH (which we did a couple steps past). If it’s a bad link or a problematic file you could delete and then use the ln -s command I gave you above, but before you do that, once more try:

appium-doctor

from the command line to make sure that it’s not working.

Running ls -l /usr/local/bin/appium-doctor is returning:
lrwxr-xr-x 1 root wheel 65 10 Nov 10:46 /usr/local/bin/appium-doctor -> /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/index.js

You mention it should be linked to appium-doctor.js am I right?
sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/appium-doctor.js /usr/local/bin/appium-doctor

Running that is returning: ln: /usr/local/bin/appium-doctor: File exists
So the link has been made to the wrong .js file?

appium-doctor still returns: zsh: permission denied: appium-doctor

You must have installed appium-doctor as root. Only the root user or someone in the wheel group (hint: not you) can use this application.

I would try chowning this file. It’s already pointing to the right place. Here is your command:

sudo chown chaffe:staff /usr/local/bin/appium-doctor

Then give the command appium-doctor at the command line.

If that does not work (for whatever reason) then delete the symbolic link:

sudo rm -rf /usr/local/bin/appium-doctor

And then add a new symbolic link:

sudo ln -s /Users/chaffe/.npm-global/lib/node_modules/appium-doctor/appium-doctor.js /usr/local/bin/appium-doctor

@wreed you solved it, thank you for your support on this and your mastery in the cli. I am extremely grateful.