Home > Back-end >  Error installing uiautomator2 driver with Appium
Error installing uiautomator2 driver with Appium

Time:08-04

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! > [email protected] 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> [email protected] 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?

CodePudding user response:

I could solve this issue by following this:

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

Seems to be a problem with [email protected]

Workaround was to install npm v6:

$ npm -g install npm@6

after that I could install the driver with appium command

  • Related