How To Install, Start Appium And Fix Install Errors Example

Appium is an automated testing tool for the mobile terminal, similar to selenium, which can drive Android, iOS, and other devices to complete automated testing, such as simulating click, slide, input, and other operations. Its official website is http://appium.io/. In this article, we’ll talk about how to install and use Appium.

1. Install Appium With Installer Directly.

  1. Download the Appium desktop installation package directly.
  2. Appium desktop supports full platform ( macOS, Linux, Windows) installation. We can install it directly from Appium GitHub releases download link.

2. Install  Appium With Node.js Package Installation.

  1. You can also install Appium with the Node.js package installation like below source code.
  2. First, you should install Node.js on your OS. On macOS, you can run the command $ brew install node in a terminal to install it.
  3. After installing Node.js on your OS, you can run the command node in the terminal to enter node interactive console.
    $ node
    Welcome to Node.js v14.16.0.
    Type ".help" for more information.
    >
  4. Input the command .exit to quit the Node.js REPL terminal.
    > .exit
    $
  5. Run the command $ node -v to show the installed Node.js version.
    $ node -v
    v14.16.0
  6. Run the command $ node -h to list Node.js help text.
  7. Now use the $ sudo npm install -g appium command to install Appium globally like below. If you do not add the -g parameter, it will install Appium under the current directory.  You can also first run the command su to change to the root user, then run the command npm install -g appium to install Appium.
    $ sudo npm install -g appium
  8. If you want to verify all the dependencies required by the Appium has been installed, you can install the appium-doctor with the command sudo npm install -g appium-doctor.
    $ sudo npm install -g appium-doctor

3. How To Fix The Error installing Chromedriver: EACCES: permission denied When Install Appium.

  1. When running the command $ sudo npm install -g appium, it may display an error message like below.
    Error installing Chromedriver: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/202124-5257-sg7cjb.mb3y'
    [14:06:56] Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/202124-5257-sg7cjb.mb3y'
    [14:06:56] Downloading Chromedriver can be skipped by using the '--chromedriver-skip-install' flag or setting the 'APPIUM_SKIP_CHROMEDRIVER_INSTALL' environment variable.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] postinstall: `node install-npm.js`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the [email protected] postinstall script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/songzhao/.npm/_logs/2021-03-04T06_06_59_615Z-debug.log
    
  2. From the above error message Error: EACCES: permission denied, mkdir, we should go to the folder /usr/local/lib/node_modules/ and see that the user wheel does not have write permission, so it can not create the appium folder in it.
    $ ls -l /usr/local/lib/
    total 1912
    ......
    drwxr-xr-x  3 root      wheel      96 Mar  4 14:06 node_modules
    ......
  3. To fix this issue, you can run the command sudo npm install -g appium –unsafe-perm=true –allow-root to install it which will pass the safety error.
    $ sudo npm install -g appium --unsafe-perm=true --allow-root
    /usr/local/bin/appium -> /usr/local/lib/node_modules/appium/build/lib/main.js
    
    > [email protected] install /usr/local/lib/node_modules/appium/node_modules/appium-windows-driver
    > node install-npm.js
    
    Not installing WinAppDriver since did not detect a Windows system
    
    > [email protected] postinstall /usr/local/lib/node_modules/appium/node_modules/core-js
    > node -e "try{require('./postinstall')}catch(e){}"
    
    Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
    
    The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
    > https://opencollective.com/core-js 
    > https://www.patreon.com/zloirock 
    
    Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
    
    
    > [email protected] postinstall /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver
    > node install-npm.js
    
    [14:25:06] [Chromedriver Install] Installing Chromedriver version '86.0.4240.22' for platform 'mac' and architecture '64'
    [14:25:06] [Chromedriver Install] Opening temp file to write 'chromedriver_mac64' to...
    [14:25:06] [Chromedriver Install] Opened temp file '/tmp/202124-5397-19lh4at.a3a5/chromedriver_mac64.zip'
    [14:25:06] [Chromedriver Install] Downloading https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_mac64.zip to '/tmp/202124-5397-19lh4at.a3a5/chromedriver_mac64.zip'
    dbug Support https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_mac64.zip (7.44 MB) has been downloaded to '/tmp/202124-5397-19lh4at.a3a5/chromedriver_mac64.zip' in 2.687s
    dbug Support Approximate download speed: 2.77 MB/s
    [14:25:09] [Chromedriver Install] Extracting /tmp/202124-5397-19lh4at.a3a5/chromedriver_mac64.zip to /tmp/202124-5397-19lh4at.a3a5/chromedriver_mac64
    [14:25:09] [Chromedriver Install] Creating /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac...
    [14:25:09] [Chromedriver Install] Copying unzipped binary, reading from /tmp/202124-5397-19lh4at.a3a5/chromedriver_mac64/chromedriver...
    [14:25:09] [Chromedriver Install] Writing to /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver...
    [14:25:09] [Chromedriver Install] /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver successfully put in place
    + [email protected]
    added 769 packages from 627 contributors in 25.232s
  4. This is because you add -g option, this option will install Appium globally, when you use npm to install packages globally, it will throw EACCES: permission denied error.

4. How To Start Appium.

  1. Run the command appium to start the Appium in the macOS console.
    $ appium
    [Appium] Welcome to Appium v1.20.2
    [Appium] Appium REST http interface listener started on 0.0.0.0:4723

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.