I think the next step is to find where this is installed. Can you try this command?
npm root -g
This will tell you where global modules are installed. Then you should be able to find the appium module and executable, and then link it to you ‘/usr/local/bin’ directory.
So I found Appium within /Users/chaffe/.npm-global/lib/node_modules, /Users/chaffe/.npm-global/bin is the exact location of Appium and Appium doctor, so why or how does it not recognise it if it recognises npm?
point to another path? And if you took the output from the which command and did an ls -l on it, does it show as a symbolic link? If so, the output of the ls -l command will start with the letter ‘l’. Might look something like:
lrwxr-xr-x
At the beginning. If so, then for whatever reason npm failed to create a symbolic link in that path. You can do so yourself to fix it. Come back with the paths from above and I’ll craft you one, or if you’d like to read about them:
so which appium-doctor returns nothing
In regards to ls -l I’m not sure if you mean on npm root -g ls -l this path or another? the response of that is still: /Users/chaffe/.npm-global/lib/node_modules
Which commands should I run to establish the paths necessary?
Two days before I too face the same issue on my windows machine. I am using appium cli and installed using npm i -g appium and no error reported by appium-doctor.
Finally, I uninstalled NodeJS and installed again.
I found https://github.com/appium/appium/issues/6738 (from @wreed) which appears to be the same issue. Attempted ln -fs /Users/chaffe/.npm-packages/lib/node_modules/appium/build/lib/main.js /usr/local/bin/appium and got access denied, then n -fs /Users/chaffe/.npm-packages/lib/node_modules/appium/build/lib/main.js /usr/local/bin/appium chmod +x /usr/local/bin/appium I get ln: /usr/local/bin/appium: No such file or directory
My apologies. I’ve had to step back from the board as I’ve contracted covid.
However, let me see if I can get you on track. In looking over my machine, I’m realizing that I haven’t asked you how you installed Node/NPM. I’m using NVM (Node Version Manager) so that I can have different versions and switch between them with ease. When I look at my ~/.zshrc, it’s full of references to NVM, and that is how I am seeing ‘appium’ in my $PATH, and how I can call it directly. What is your setup like?
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:
@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
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?
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