Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't upgrade to 9.2.4 or higher #1440

Open
ValzRon opened this issue Nov 12, 2024 · 6 comments
Open

Can't upgrade to 9.2.4 or higher #1440

ValzRon opened this issue Nov 12, 2024 · 6 comments

Comments

@ValzRon
Copy link
Contributor

ValzRon commented Nov 12, 2024

Im running a Docker container with Ubuntu 24.04 and the newest Appium and Espresso driver. When i try to upgrade device farm higher than 9.2.3, my container throws this error

ARG APPIUM_VERSION=2.12.1                    
ARG ESPRESSO_VERSION=3.5.0                   
ARG DEVICE_FARM_VERSION=9.2.4
RUN npm install -g appium@${APPIUM_VERSION} &&     appium driver install espresso@${ESPRESSO_VERSION} &&     appium plugin install --source=npm appium-device-farm@${DEVICE_FARM_VERSION} &&     exit 0
....
✔ Checking if 'appium-device-farm' is compatible
- Installing '[email protected]'
✖ Installing '[email protected]'
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 [email protected] --json' failed with code 254.

STDOUT:
{
  "error": {
    "code": "ENOENT",
    "summary": "An unknown git error occurred",
    "detail": "This is related to npm not being able to find a file."
  }
}

Any ideas?

@saikrishna321
Copy link
Member

@ValzRon Can you reinstall appium and try again. Please provide the Dockerfile we can try from our side as well.

@ValzRon
Copy link
Contributor Author

ValzRon commented Nov 13, 2024

@saikrishna321 I tried to delete the cache and build the image from scratch, so Appium should be a fresh install.

Here is my Dockerfile:

FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

#============
# Set WORKDIR
#============
WORKDIR /root

#=================================================
# General Packages
#------------------
# openjdk-17-jdk
#   Java
# ca-certificates
#   SSL client
# tzdata
#   Timezone
# zip
#   Make a zip file
# unzip
#   Unzip zip file
# curl
#   Transfer data from or to a server
# wget
#   Network downloader
# libqt5webkit5
#   Web content engine (Fix issue in Android)
# xvfb
#   X virtual framebuffer
# gnupg
#   Encryption software. It is needed for nodejs
#=================================================
RUN apt-get -qqy update && \
    apt-get -qqy --no-install-recommends install \
    openjdk-17-jdk \
    ca-certificates \
    tzdata \
    zip \
    unzip \
    curl \
    wget \
    libqt5webkit5 \
    xvfb \
    gnupg \
    python3 \

  && rm -rf /var/lib/apt/lists/*

#==============
# Set JAVA_HOME
#==============
ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64" \
    PATH=$PATH:$JAVA_HOME/bin

#====================
# Install Android SDK
#====================
ARG COMMAND_LINE_TOOLS=commandlinetools-linux-8512546_latest

ARG ANDROID_BUILD_TOOLS_VERSION=34.0.0
ARG ANDROID_PLATFORM_VERSION="android-34"

ENV COMMAND_LINE_TOOLS=$COMMAND_LINE_TOOLS \
    ANDROID_BUILD_TOOLS_VERSION=$ANDROID_BUILD_TOOLS_VERSION \
    ANDROID_SDK_ROOT=/root

#============================================================================================================================
# cmdline-tools folder structure tends to change
# Right now the correct path must be $ANDROID_SDK_ROOT/cmdline-tools/version/bin ->
# https://stackoverflow.com/questions/60440509/android-command-line-tools-sdkmanager-always-shows-warning-could-not-create-se
#============================================================================================================================
RUN mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/ && \
    cd $ANDROID_SDK_ROOT/cmdline-tools/ && \
    wget -O cmdline-tools.zip https://dl.google.com/android/repository/${COMMAND_LINE_TOOLS}.zip && \
    unzip cmdline-tools.zip && rm cmdline-tools.zip && \
    mv ~/cmdline-tools/cmdline-tools/ ~/cmdline-tools/latest/ && \
    chmod a+x -R $ANDROID_SDK_ROOT && \
    chown -R root:root $ANDROID_SDK_ROOT

ENV PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin

# https://developer.android.com/studio/command-line/sdkmanager
RUN echo y | sdkmanager "platform-tools" && \
    echo y | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" && \
    echo y | sdkmanager "platforms;$ANDROID_PLATFORM_VERSION"

ENV PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/build-tools

#============================================================
# Google Cloud SDK
#============================================================
RUN curl -sSL https://sdk.cloud.google.com | bash

# Adding the package path to local
ENV PATH $PATH:/root/google-cloud-sdk/bin

#============================================================
# Install NodeJS and NPM
# https://github.com/nodesource/distributions#ubuntu-versions
#============================================================
ARG NODE_MAJOR_VERSION=23
ARG NPM_VERSION=10.9.0

RUN mkdir -p /etc/apt/keyrings && \
    curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
    echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

RUN apt-get -qqy update && \
    apt-get -qq install nodejs -y

RUN npm install -g npm@${NPM_VERSION}

#=======================================================
# Install latest Appium, Espresso Driver and Device Farm
#=======================================================
ARG APPIUM_VERSION=2.12.1
ARG ESPRESSO_VERSION=3.5.0
ARG DEVICE_FARM_VERSION=9.2.3

RUN npm install -g appium@${APPIUM_VERSION} && \
    appium driver install espresso@${ESPRESSO_VERSION} && \
    appium plugin install --source=npm appium-device-farm@${DEVICE_FARM_VERSION} && \
    exit 0

#=================
# Set Appium Home
#=================
ENV APPIUM_HOME=/root/.appium

#==================================
# Fix Issue with timezone mismatch
#==================================
ENV TZ="US/Pacific"
RUN echo "${TZ}" > /etc/timezone

#======================================
# Scripts to run appium and device farm
#======================================
COPY start_device_farm.sh \
     espressoBuildConfig.json \
     appium-server-config.yaml \
     connect_farm_to_emus.sh \
     /root/

RUN chmod +x /root/start_device_farm.sh && \
    chmod +x /root/connect_farm_to_emus.sh

EXPOSE 4723

#========================================
# SET GRADLE SETTINGS
#========================================
ARG ESPRESSO_SERVER_ROOT=/root/.appium/node_modules/appium-espresso-driver/espresso-server
ARG GRADLE_WRAPPER_PROPERTIES=${ESPRESSO_SERVER_ROOT}/gradle/wrapper/gradle-wrapper.properties

RUN echo 'android.useAndroidX=true\norg.gradle.incremental=true\norg.gradle.daemon=true\norg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m' > ${ESPRESSO_SERVER_ROOT}/gradle.properties
RUN sed -i 's/gradle-.*\.zip/gradle-8.7-all.zip/g' ${GRADLE_WRAPPER_PROPERTIES}

#===================================================================================
# Change back into workspace to run Emulator connect script and Appium server script
#===================================================================================
RUN cd $WORKDIR
CMD /root/connect_farm_to_emus.sh && /root/start_device_farm.sh

@sudharsan-selvaraj
Copy link
Member

@ValzRon Are you still facing the same issue? If so, can you try with the latest version 9.4.13?

@ValzRon
Copy link
Contributor Author

ValzRon commented Dec 17, 2024

@sudharsan-selvaraj I just tried it with 9.4.13, same issue. I tried to run appium plugin install --source=npm [email protected] and then appium plugin update device-farm, doesnt work either.
The pipeline is green because the old version was installed but the update exits with the same error above.

@saikrishna321
Copy link
Member

@ValzRon Can you please with node v20

@ValzRon
Copy link
Contributor Author

ValzRon commented Dec 19, 2024

@saikrishna321 I tried it with Node js major version 20 and NPM 10.8.2 , still doesnt work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants