The npm community forum has been discontinued.
To discuss usage of npm, visit the GitHub Support Community.
[macOS Catalina 1.15.0 ] Appium through command line not available after downgrading
What I Wanted to Do
After downgrading Appium packages through npm, I lost appium
even though the environment variable is available in my .bash_profile
What Happened Instead
When I run
~ which appium
~ appium -v
-sh: appium: command not found
~ node -v v12.11.1 ~ npm -v
- Appium version (or git revision) that exhibits the issue: 1.9.1
- Last Appium version that did not exhibit the issue (if applicable): 1.14.1
- Desktop OS/version used to run Appium: macOS Catalina 10.15
- Node.js version (unless using Appium.app|exe):
- Mobile platform/version under test: iOS 12.1
- Real device or emulator/simulator: iPhone 6
- Appium CLI or Appium.app|exe: CLI
node -p process.platform
Some background first.
Commands associated with global installs are linked into the bin folder under the “prefix” destination. For example, my global installs go to
/usr/local, so the packages go into
/usr/local/lib/node_modules and the commands are linked into
$ npm prefix -g /usr/local $ npm install -g n /usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n + email@example.com updated 1 package in 1.203s
The commands are found because the bin folder is listed in
$PATH, see mine contains
$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Now for your problem. If you check with the above commands, I expect the bin folder for your global prefix is not listed in your “PATH”?
(It looks like you installed node using HomeBrew? I am not sure of the usual practice for HomeBrew installations and managing node and npm, but will confirm my assumptions so far before suggesting anything else!)
Yes, npm was likely set up with brew.
But npm packages are available in /usr/local/Cellar and also
in /usr/local/bin. I attached a gist to my comment
Below my .bash_profile before alteration :
And below my console output :
Last login: Mon Oct 7 10:37:51 on ttys001
~ npm prefix -g /usr/local/Cellar/node/9.3.0_1 ~ npm install -g n
/usr/local/Cellar/node/9.3.0_1/bin/n -> /usr/local/Cellar/node/9.3.0_1/lib/node_modules/n/bin/n
added 1 package from 4 contributors in 0.246s
I removed also npm and node. I let you check my terminal output.
So my question is how to set npm prefix and install npm and node without brew ?
Thank you for your attention in this matter.
Should I download node from their website or what is the proper way to install npm on Mac ?
node and npm can work with HomeBrew, but lets leave that out of the picture for now.
I see you installed
n. Here are two simple options, pick one. In both cases npm gets installed along with node.
Either option 1: install node from https://nodejs.org/ using the Mac installer
Or option 2:
First command to try after installing is
npm prefix -g
If things are working as expected then you should see:
$ npm prefix -g /usr/local
If you do not see that then there is some more debugging to do.
Thank you. I appreciate it. I can keep on working with Appium.