Install nodejs using homebrew and install appium
I was very exited to install appium but one major issue I encountered is that you can't npm-install it using sudo.
Well that's really annoying because I'm installing it on a VM that has a shared folder, and I have to use sudo... damn...
So I tired several solutions, and found that the best thing to do, is install nodejs and npm allover again using Homebrew.
I thought it's a good place to share the process I went through:
Note that I'm running Ubuntu 13.04 64bit Using VirtualBox.
This solution worked for me, but I hope that will help someone, someday.
Enjoy!
- Uninstall node and npm:
sudo apt-get remove nodejs
- install linuxbrew:
ruby -e "$(wget -O- https://raw.github.com/Homebrew/linuxbrew/go/install)"
- Add linuxbrew to path:
In many places you might see that you need to add the following lines to .bashrc
In my case, .bashrc is not loaded each time I open the terminal, instead .bash_profile was the right place.
export PATH="$HOME/.linuxbrew/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/.linuxbrew/lib:$LD_LIBRARY_PATH"
so just add these two lines to the file that fits your machine.
- Install nodejs and npm:
brew install node
- Existing global packages.
If you have already installed global packages, make sure they will be in the newly created global packages folder. Since I didn't have many, I just reinstalled them. Default folder is:
~/.linuxbrew/lib/node_modules
old one was:
~/node_modules
- Install appium globally:
npm install -g appium
- Install appium client in your project folder:
npm install wd
-
Download and Install Android SDK:
- Download from: http://developer.android.com/index.html
- unzip the downloaded file. I put it under the $HOME path and named the folder
/adt
Add the following paths to .bashrc / .bash_profile:
export ANDROID_HOME="$HOME/adt/sdk"
export JAVA_HOME="/usr/bin/java"
export PATH=${PATH}:~/adt/sdk/tools
export PATH=${PATH}:~/adt/sdk/platform-tools
- Install needed packages:
android
-
Add AVD (Andorid virtual device)
- Go to "Device Definitions"
- Click on the wanted device.
- Click create AVD.
- Go to Android Virtual Devices.
- Click Start.
Start appium server:
appium &
- Run tests:
node your-appium-test.js
References:
- http://appium.io/
- http://stackoverflow.com/questions/5650169/uninstall-node-js-using-linux-command-line
- https://github.com/Homebrew/linuxbrew
- http://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically
- http://appium.io/slate/en/master/?ruby#about-appium
- http://askubuntu.com/questions/318246/complete-installation-guide-for-android-sdk-adt-bundle-on-ubuntu
Written by Shlomi Toussia-Cohen
Related protips
2 Responses
Hi,
I used following command to install the appium in ubuntu but when i gave appium & command it showing me error message like
[1] 11411
/Home/Username:~$ appium: command not found
Please help me out to resolve this problem
Install appium in linuxmint/Ubuntu with complete steps via terminal
https://techsouljours.blogspot.com/2018/03/install-appium-in-linux-mint.html