I previously deleted uiautomator2 with the following command:
appium driver uninstall uiautomator2
But now I want to install it again with below command:
appium driver install uiautomator2
But I get the following error (Log):
✔ Checking if 'appium-uiautomator2-driver' is compatible
✖ Installing 'uiautomator2' using NPM install spec 'appium-uiautomator2-driver'
Error: ✖ Encountered an error when installing package: npm command 'install --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-uiautomator2-driver --json' failed with code 190.
STDOUT:
{
"error": {
"code": "ENOTEMPTY",
"summary": "ENOTEMPTY: directory not empty, rename '/Users/amir/.appium/node_modules/appium' -> '/Users/amir/.appium/node_modules/.appium-zHQBBKga'",
"detail": ""
}
}
STDERR:
npm WARN config global-style This option has been deprecated in favor of `--install-strategy=shallow`
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/amir/.appium/node_modules/appium
npm ERR! dest /Users/amir/.appium/node_modules/.appium-zHQBBKga
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/amir/.appium/node_modules/appium' -> '/Users/amir/.appium/node_modules/.appium-zHQBBKga'
npm ERR! A complete log of this run can be found in: /Users/amir/.npm/_logs/2024-03-04T04_37_22_502Z-debug-0.log
Full Logs(2024-03-04T04_37_22_502Z-debug-0.log): 2024-03-04T04_37_22_502Z-debug-0.log
Delete this temp folder manually and try again
gave another error:
✔ Checking if 'appium-uiautomator2-driver' is compatible
✖ Installing 'uiautomator2' using NPM install spec 'appium-uiautomator2-driver'
Error: ✖ Encountered an error when installing package: npm command 'install --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock appium-uiautomator2-driver --json' failed with code 190.
STDOUT:
{
"error": {
"code": "ENOTEMPTY",
"summary": "ENOTEMPTY: directory not empty, rename '/Users/amir/.appium/node_modules/appium-xcuitest-driver' -> '/Users/amir/.appium/node_modules/.appium-xcuitest-driver-WP6SXwnJ'",
"detail": ""
}
}
STDERR:
npm WARN config global-style This option has been deprecated in favor of `--install-strategy=shallow`
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/amir/.appium/node_modules/appium-xcuitest-driver
npm ERR! dest /Users/amir/.appium/node_modules/.appium-xcuitest-driver-WP6SXwnJ
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/amir/.appium/node_modules/appium-xcuitest-driver' -> '/Users/amir/.appium/node_modules/.appium-xcuitest-driver-WP6SXwnJ'
npm ERR! A complete log of this run can be found in: /Users/amir/.npm/_logs/2024-03-04T08_45_01_657Z-debug-0.log
just follow the same pattern
1 Like
If you encounter this problem, you should delete all the contents of the “node_modules” folder at this address “/Users/amir/.appium/node_modules”
Then uiautomator2 will be installed again for you easily