Starting from appium 2.x, appium decoupled appium drivers from it’s base installation.
Now users need to install appium drivers individually as per the need basis.
Install appium 2 –
To install the appium 2 globally on your machine –
npm install -g appium
If you are using mac, then you can run using sudo command –
sudo npm install -g appium
Enter your mac system password once prompted.
On windows, open the command prompt in admin mode and run the command –
npm install -g appium
To uninstall appium –
npm uninstall -g appium
List all available appium drivers –
To list down all the available appium drivers – (whether installed or not)
appium driver list
Individual appium driver installation –
Appium decoupled all the drivers and have to install them individually on a need basis.
Example –
Run below command for IOS driver i.e – xcuitest
appium driver install xcuitest
For android i.e – uiautomator2
appium driver install uiautomator2
Verify the installations –
You can install appium-doctor npm package to verify the installations
npm install -g appium-doctor
appium-doctor --version
Then individually for all appium drivers, we can verify the setup is correct to run tests on Android or IOS devices.
appium-doctor —-android
appium-doctor —-ios
Updating the appium drivers –
To list down all the appium drivers installed on machine –
appium driver list
To verify if any updates available
appium driver list --updates
To update individual appium drivers or multiple drivers at a time –
appium driver update xcuitest
or
appium driver update xcuitest, uiautomator2 …
Note – All the drivers are installed under home/.appium
Uninstalling individual drivers
appium driver uninstall [driverName] || true
|| true
will uninstall if it’s installed.
example –
appium driver uninstall xcuitest || true
as per https://github.com/appium/appium/discussions/16598
Issue –
sometimes you might get an error while installing individual drivers as mentioned below –
appium driver install uiautomator2
———————————————————————————-
info Appium Setting NODE_PATH to ‘/usr/local/lib/node_modules’
✖ Installing ‘uiautomator2’ using NPM install spec ‘appium-uiautomator2-driver’
Error: ✖ Encountered an error when installing package: npm command ‘install –save-dev appium-uiautomator2-driver –json’ failed with code 1.
STDOUT:
STDERR:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: appium@1.22.3
npm ERR! node_modules/appium
npm ERR! appium@”^1.22.1″ from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer appium@”^2.0.0-beta.40″ from appium-uiautomator2-driver@2.7.0
npm ERR! node_modules/appium-uiautomator2-driver
npm ERR! dev appium-uiautomator2-driver@”*” from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with –force, or –legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/skpatro/.npm/eresolve-report.txt for a full report.
{
“error”: {
“code”: “ERESOLVE”,
“summary”: “unable to resolve dependency tree”,
“detail”: “\nWhile resolving: undefined@undefined\nFound: appium@1.22.3\nnode_modules/appium\n appium@\”^1.22.1\” from the root project\n\nCould not resolve dependency:\npeer appium@\”^2.0.0-beta.40\” from appium-uiautomator2-driver@2.7.0\nnode_modules/appium-uiautomator2-driver\n dev appium-uiautomator2-driver@\”*\” from the root project\n\nFix the upstream dependency conflict, or retry\nthis command with –force, or –legacy-peer-deps\nto accept an incorrect (and potentially broken) dependency resolution.\n\nSee /Users/skpatro/.npm/eresolve-report.txt for a full report.”
}
}
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/userName/.npm/_logs/2022-09-21T07_02_04_446Z-debug-0.log
———————————————————————————-
Solution –
Navigate to users/userName directory and delete the following folder and files
- /node_modules/
- package.json
- package.lock.json
These above files refer to earlier appium installation.
then try to run command to install appium drivers, you should be good now!
1 Comment