1

I am pretty new to appium and I tried installing the uiautomator2 driver to the latest appium version 2.0.0-beta.41 via the command appium driver install uiautomator2

I always get this output:

> STDERR:
npm ERR! code 1
npm ERR! path C:\Users\marti\AppData\Roaming\npm\node_modules\appium
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\marti\AppData\Local\Temp\prepare-6703812f.cmd
npm ERR! > appium@2.0.0-beta.41 build
npm ERR! > babel lib --root-mode=upward --out-dir=build/lib
npm ERR! SyntaxError: lib/appium.js: Unexpected token (47:11)
npm ERR!   45 |    * @type {Record<string,ExternalDriver>}
npm ERR!   46 |    */
npm ERR! > 47 |   sessions = {};
npm ERR!      |            ^
npm ERR!   48 |
npm ERR!   49 |   /**
npm ERR!   50 |    * Access to pending drivers list must be guarded with a Semaphore, because
{
  "error": {
    "code": 1,
    "summary": "command failed",
    "detail": "C:\\Windows\\system32\\cmd.exe /d /s /c C:\\Users\\marti\\AppData\\Local\\Temp\\prepare-6703812f.cmd\n> appium@2.0.0-beta.41 build\n> babel lib --root-mode=upward --out-dir=build/lib\nSyntaxError: lib/appium.js: Unexpected token (47:11)\n  45 |    * @type {Record<string,ExternalDriver>}\n  46 |    */\n> 47 |   sessions = {};\n     |
 ^\n  48 | \n  49 |   /**\n  50 |    * Access to pending drivers list must be guarded with a Semaphore, because"
  }
}

So this error is probably related to babel trying to transpile the lib/appium.js file?

I already installed babel via pm install babel-cli babel-core --save-dev

What else do I need to do?

Scuba
  • 83
  • 1
  • 6

5 Answers5

3

Run

npm i appium-uiautomator2-driver
General Grievance
  • 4,555
  • 31
  • 31
  • 45
1

I could solve this issue by following this:

https://github.com/appium/appium/issues/17287

Seems to be a problem with appium@2.0.0-beta.41

Workaround was to install npm v6:

$ npm -g install npm@6

after that I could install the driver with appium command

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Scuba
  • 83
  • 1
  • 6
1

Use appium-installer to install everything it will make life way easy :) https://github.com/AppiumTestDistribution/appium-installer

Also, switch to the latest versions as on 16 June 2023

  • v2.0.0-rc.3 - Appium
  • 2.26.1 - uiautomator2. To upgrade run this command --> appium driver update uiautomator2
0

While running "appium driver install uiautomator2" , if you get error "Error installing Chromedriver: Socket connection timeout", then run the below command APPIUM_SKIP_CHROMEDRIVER_INSTALL=1 appium driver install uiautomator2

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 07 '23 at 02:26
-2

enter image description here node release Index of /dist/latest-v14.x/ https://nodejs.org/dist/latest-v14.x/ node-v14.21.1.pkg for mac

first of all install these release.

secondly open your terminal and ("appium driver install uıautomater2 ") thirdly ("appium driver install xcuitest ") enter image description here

at least uninstall your node then reinstall node lastest release!