appium / appium-docker-android

Appium Server setup to automate android testing on real devices
https://hub.docker.com/r/appium/
Other
605 stars 230 forks source link

Crash while building image for Appium 1.7.0-beta #134

Closed kayner closed 4 years ago

kayner commented 4 years ago

During the docker image build with the command: $ docker build -t "appium/appium:local" -f Appium/Dockerfile Appium

The following error occurs:

> node ./bin/install.js

/usr/lib/node_modules/appium/node_modules/appium-selendroid-driver/bin/install.js:21
  androidHelpers.getJavaVersion(false).then(function tryInstall (version) {
                 ^
TypeError: androidHelpers.getJavaVersion is not a function
    at doInstall (/usr/lib/node_modules/appium/node_modules/appium-selendroid-driver/bin/install.js:21:18)
    at Object.<anonymous> (/usr/lib/node_modules/appium/node_modules/appium-selendroid-driver/bin/install.js:63:3)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.x (node_modules/appium/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appium-selendroid-driver@1.13.4 install: `node ./bin/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the appium-selendroid-driver@1.13.4 install 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!     /root/.npm/_logs/2020-08-06T12_27_35_858Z-debug.log
The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_12.x | bash &&     apt-get -qqy install nodejs &&     npm install -g appium@${APPIUM_VERSION} --unsafe-perm=true --allow-root &&     exit 0 &&     npm cache clean &&     apt-get remove --purge -y npm &&     apt-get autoremove --purge -y &&     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* &&     apt-get clean' returned a non-zero code: 1

Possible Solution

I cannot say what exactly caused this error, but it does not appear on the current version of Appium 1.18.0 and Appium 1.17.0. According to npmjs Appium 1.7.0-beta was released over 3 years ago.

I think it makes sense to update the Appium version in the Dockerfile to the current one, like this: Replace the line ARG APPIUM_VERSION = 1.7.0-beta in Dockerfile with ARG APPIUM_VERSION = 1.18.0. There is also a workaround, specify at build time --build-arg APPIUM_VERSION = 1.18.0.

Steps to Reproduce

  1. git clone https://github.com/budtmo/docker-android
  2. cd docker-android
  3. docker build -t "appium/appium:local" -f Appium/Dockerfile Appium

Context (Environment)

  1. Kubuntu 20.04
  2. Docker version 19.03.12, build 48a66213fe
kalidasya commented 4 years ago

I have the same issue, any workarounds/ideas?

kalidasya commented 4 years ago

it seems it works for the latest appium

kayner commented 4 years ago

it seems it works for the latest appium

As I said, there are solutions to this problem:

Replace the line ARG APPIUM_VERSION = 1.7.0-beta in Dockerfile with ARG APPIUM_VERSION = 1.18.0. There is also a workaround, specify at build time --build-arg APPIUM_VERSION = 1.18.0

kalidasya commented 4 years ago

oops I missed that

kayner commented 4 years ago

I see a similar PR #128 to fix this issue. Okay, if this is normal behavior then I will close this issue.