Appium command not found

Fairly basic, just got a new machine and setting up Appium.

Installed Appium Server GUI to the desktop and then ran npm i -g appium as well as the same command for appium-doctor.

I type appium -v and get zsh: command not found: appium

When I do which appium: appium not found
npm -g list
/Users/chaffe/.npm-global/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Not really sure where it’s going wrong. I can see in terminal they’ve installed and they’re in my -g list, any pointers to where I’ve gone wrong?

Probably needs some login script adjustment:

https://stackoverflow.com/questions/56459324/npm-install-zsh-command-not-found-npm

Sadly not, npm install works hence why I’m able to run the package but it doesn’t find appium…

What did you try and what error did you get? My mind reading skills aren’t very good.

npm i -g appium

type: appium -v
return: zsh: command not found: appium

You should try some of the suggestions in the link I posted. Sorry, that’s what I meant to recommend. I wasn’t explicit, but trying those could really help you in your situation.

I just thought you would get that intuitively. My bad.

Let me try this again. I think you are seeing this issue:

Apologies if I’m being obtuse. This should help you.

make sure you install it without sudo command as suggested by appium.
after installation, you should be able to see the appium directory. path: ~/.appium to see the hidden files use ls -a command on your HOME directory path.

if it is there by any chance, delete it and then uninstall and reinstall appium again.

also check manually if you see appium execution file in the binary directory. path: /usr/local/bin/appium

Maybe I’m just being an idiot, most likely, but I’m revisiting this now. I’ve attempted to edit the path using Wreed’s suggestion which I also found and attempted to re-install but still Appium isn’t there. When I’m in the home directory as suggested by ido, I am manually checking and Appium isn’t there either. No hidden file present. What else is there to try?

  • Check if the appium executable is present on the local FS: ls /usr/local/bin/appium
  • If it is there then make sure /usr/local/bin/ is present in your local PATH: echo $PATH

So, let’s dumb this down to make sure I’m getting it right. I’ve checked my lfs but can’t find Appium despite it being present when I do npm i -g appium then npm -g list which returns:
/Users/chaffe/.npm-global/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
my local path:
/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

next steps?

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.

Additional info:
https://www.geeksforgeeks.org/where-does-npm-install-the-packages/

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?

Does this command:

which appium-doctor

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?

Most likely you have the global path prefix modified somwehere in .npmrc config. Check
https://stackoverflow.com/questions/19874582/change-default-global-installation-directory-for-node-js-modules-in-windows
https://stackoverflow.com/questions/14803978/npm-global-path-prefix

You could either change/reset the prefix or add the current global binaries folder to PATH and use it further.

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


even when I put the files in /usr/local/bin I get the same error

Any other thoughts?

@wreed do you mind helping any further on this?

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?