Java-Client 5.0.1 error - JAVA_HOME is not set currently. Please set JAVA_HOME

Our test runs smoothly with Java-Cleint 4.1.2 (Appium - 1.6.5)

Now we upgrade it to Java-Client 5.0.1

When the code attempts to initiate the appium driver it fails with the bottom error log.
It says that the Java home wasn’t set properly however on the appium-doctor it seems fine & on the Java-Client 4.1.2 it works fine as well.

Any idea what we are missing?

This is The desired capabilities (is anything missing for Java-Client 5.0.1?)
DesiredCapabilities capabilities = DesiredCapabilities.android();
capabilities.setCapability(MobileCapabilityType.APP, genMeth.getValueFromPropFile(“appPath”));
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, genMeth.getValueFromPropFile(“deviceName”));
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);
capabilities.setCapability(“automationName”,“uiautomator2”);


[RemoteTestNG] revisions:

git.commit.id=4f29d2b

git.branch=4f29d2b4f03d98ec727e1941758af66ae27e0458

git.build.version=1.2.0

[RemoteTestNG] detected TestNG version 6.9.9

[RemoteTestNG] Invoked with -serport 52344 -protocol json -d /Users/menypeled/Documents/workspace/Droid_Appium/test-output /Users/menypeled/Documents/workspace/Droid_Appium/src/resources/Testng.xml

[BaseMessageSender] Waiting for Eclipse client on localhost:52344

[BaseMessageSender] Received a connection from Eclipse on localhost:52344

[BaseMessageSender] Connection established, starting reader thread

[BaseMessageSender] ReaderThread waiting for an admin message

[JsonMessageSender] Sending message [GenericMessage ==> suiteCount:1, testCount:1]

[BaseMessageSender] ReaderThread received admin message:>ACK

[BaseMessageSender] Received ACK:>ACK

[BaseMessageSender] Received ACK:>ACK

[TestNG] Running:

/Users/menypeled/Documents/workspace/Droid_Appium/src/resources/Testng.xml

[JsonMessageSender] Sending message [SuiteMessage ==> suite:Suite, starting, methodCount:0]

[BaseMessageSender] Received ACK:>ACK

[BaseMessageSender] Received ACK:>ACK

Please choose Environment mode(1 for QA, 2 for Staging or 3 for PROD):1

Testing against QA Environment

Do you want to use Applitools eye?(1 for Yes, or continue for No):2

Testing without Applitools visual testing

[Appium] Welcome to Appium v1.6.5

[Appium] Appium REST http interface listener started on 0.0.0.0:4723

[HTTP] --> GET /wd/hub/status {}

[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []

[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.6.5”,“revision”:null}}

[HTTP] <-- GET /wd/hub/status 200 18 ms - 83

[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“app”:"/Users/menypeled/Documents/workspace/Droid_Appium/APK/SkyGiraffe__Beta_5_11_5.apk",“newCommandTimeout”:1200,“automationName”:“uiautomator2”,“browserName”:“android”,“platformName”:“Android”,“version”:"",“deviceName”:“Nexus 5X”,“platform”:“ANDROID”}}

[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:"/Users/menypeled/Documents/workspace/Droid_Appium/APK/SkyGiraffe__Beta_5_11_5.apk",“newCommandTimeout”:1200,“automationName”:“uiautomator2”,“browserName”:“android”,“platformName”:“Android”,“version”:"",“deviceName”:“Nexus 5X”,“platform”:“ANDROID”},null,null]

[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1504081646424 (11:27:26 GMT+0300 (IDT))

[Appium] Creating new AndroidUiautomator2Driver (v0.3.3) session

[Appium] Capabilities:

[Appium] app: ‘/Users/menypeled/Documents/workspace/Droid_Appium/APK/SkyGiraffe__Beta_5_11_5.apk’

[Appium] newCommandTimeout: 1200

[Appium] automationName: ‘uiautomator2’

[Appium] browserName: ‘android’

[Appium] platformName: ‘Android’

[Appium] version: ‘’

[Appium] deviceName: ‘Nexus 5X’

[Appium] platform: ‘ANDROID’

[BaseDriver] The following capabilities were provided, but are not recognized by appium: version, platform.

[BaseDriver] Session created with session id: f4da3a9f-4fec-488c-86de-79fb68f9d970

[BaseDriver] Using local app ‘/Users/menypeled/Documents/workspace/Droid_Appium/APK/SkyGiraffe__Beta_5_11_5.apk’

[debug] [UiAutomator2] Checking whether app is actually present

[UiAutomator2] UIAutomator2 Driver version:0.3.3

[debug] [AndroidDriver] Getting Java version

[AndroidDriver] Java version is: 1.8.0_111

[ADB] Checking whether adb is present

[ADB] Using adb from /Users/menypeled/Library/Android/sdk/platform-tools/adb

[AndroidDriver] Retrieving device list

[debug] [ADB] Trying to find a connected android device

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[AndroidDriver] Using device: 00cfa6ed1739c2e7

[ADB] Checking whether adb is present

[ADB] Using adb from /Users/menypeled/Library/Android/sdk/platform-tools/adb

[debug] [ADB] Setting device id to 00cfa6ed1739c2e7

[debug] [AndroidDriver] Parsing package and activity from app manifest

[ADB] Checking whether aapt is present

[ADB] Using aapt from /Users/menypeled/Library/Android/sdk/build-tools/25.0.2/aapt

[ADB] Extracting package and launch activity from manifest

[debug] [ADB] badging package: com.skygiraffe.operationaldata

[debug] [ADB] badging act: com.skygiraffe.operationaldata.LoginScreenActivity

[debug] [AndroidDriver] Parsed package and activity are: com.skygiraffe.operationaldata/com.skygiraffe.operationaldata.LoginScreenActivity

[ADB] Getting device platform version

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“getprop”,“ro.build.version.release”]

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“wm”,“size”]

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“getprop”,“ro.product.model”]

[debug] [ADB] Current device property ‘ro.product.model’: Nexus 5X

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“getprop”,“ro.product.manufacturer”]

[debug] [ADB] Current device property ‘ro.product.manufacturer’: LGE

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“am”,“force-stop”,“io.appium.uiautomator2.server”]

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“wait-for-device”]

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“echo”,“ping”]

[debug] [Logcat] Starting logcat capture

[debug] [AndroidDriver] Pushing settings apk to device…

[debug] [ADB] Getting install status for io.appium.settings

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“pm”,“list”,“packages”,“io.appium.settings”]

[debug] [ADB] App is installed

[debug] [ADB] Getting package info for io.appium.settings

[debug] [ADB] Getting connected devices…

[ADB] Checking whether aapt is present

[ADB] Using aapt from /Users/menypeled/Library/Android/sdk/build-tools/25.0.2/aapt

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“dumpsys”,“package”,“io.appium.settings”]

[ADB] Cannot read version codes of /usr/local/lib/node_modules/appium/node_modules/io.appium.settings/app/build/outputs/apk/settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“getprop”,“ro.build.version.sdk”]

[debug] [ADB] Device API level: 25

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“dumpsys”,“package”,“io.appium.settings”]

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“pm”,“dump”,“io.appium.settings”]

[debug] [ADB] Got the following command chunks to execute: pm,grant,io.appium.settings,android.permission.WRITE_SETTINGS,;,pm,grant,io.appium.settings,android.permission.ACCESS_MOCK_LOCATION,;

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“pm”,“grant”,“io.appium.settings”,“android.permission.WRITE_SETTINGS”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_MOCK_LOCATION”,";"]

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“pm”,“grant”,“io.appium.settings”,“android.permission.WRITE_SETTINGS”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_MOCK_LOCATION”,";"]

[debug] [AndroidDriver] Pushing unlock helper app to device…

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“install”,"/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“install”,"/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]

[debug] [ADB] Application ‘/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk’ already installed. Continuing.

[debug] [ADB] Device API level: 25

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“appops”,“set”,“io.appium.settings”,“android:mock_location”,“allow”]

[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200

[debug] [ADB] Forwarding system: 8200 to device: 6790

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“forward”,“tcp:8200”,“tcp:6790”]

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“dumpsys”,“window”]

[AndroidDriver] Screen already unlocked, doing nothing

[debug] [AndroidDriver] Extracting strings from apk /Users/menypeled/Documents/workspace/Droid_Appium/APK/SkyGiraffe__Beta_5_11_5.apk null /var/folders/mr/lbh2rfw568g5v74x7g7vgx440000gn/T/com.skygiraffe.operationaldata

[debug] [ADB] Extracting strings for language: default

[debug] [ADB] Device API level: 25

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“getprop”,“persist.sys.locale”]

[debug] [ADB] Current device property ‘persist.sys.locale’: en-US

[debug] [ADB] No strings.xml for language ‘en’, getting default strings.xml

[debug] [ADB] Reading strings from converted strings.json

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“push”,"/var/folders/mr/lbh2rfw568g5v74x7g7vgx440000gn/T/com.skygiraffe.operationaldata/strings.json","/data/local/tmp"]

[debug] [UiAutomator2] Deleting UiAutomator2 session

[debug] [UiAutomator2] Deleting UiAutomator2 server session

[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: Error: Trying to proxy a session command without session id

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“shell”,“am”,“force-stop”,“com.skygiraffe.operationaldata”]

[debug] [Logcat] Stopping logcat capture

[debug] [ADB] Removing forwarded port socket connection: 8200

[debug] [ADB] Running ‘/Users/menypeled/Library/Android/sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“00cfa6ed1739c2e7”,“forward”,"–remove",“tcp:8200”]

[MJSONWP] Encountered internal error running command: Error: JAVA_HOME is not set currently. Please set JAVA_HOME.

at getJavaHome (../../lib/helpers.js:104:9)

at getJavaForOs (../../lib/helpers.js:93:17)

at ADB.callee$0$0$ (../../../lib/tools/apk-signing.js:75:16)

at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)

at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)

at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)

at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)

at F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)

at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)

at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)

at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)

at ADB.callee$0$0 [as checkApkCert] (../../../lib/tools/apk-signing.js:75:13)

at AndroidUiautomator2Driver.initAUT$ (../../lib/driver.js:318:35)

at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)

at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)

at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)

at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

[HTTP] <-- POST /wd/hub/session 500 9328 ms - 190

@menypeled try with latest appium… just in case

npm install -g appium@beta

Same error remains however I have notice the following error in the installation (see below log)

Seems that the UiAutomator2 isn’t installed.

Maybe that’s the issue? any idea how to fix the installation?

[email protected] install /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver

node ./bin/install.js

dbug AndroidDriver Getting Java version
Could not find JAVA, skipping Selendroid install.

[email protected] install /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver
node ./bin/install.js

dbug AndroidDriver Getting Java version
Could not find JAVA, skipping UiAutomator2 install.

@menypeled did you try also uninstall first?

npm uninstall -g appium

here is partial mine log during install:

> [email protected] install /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver
> node ./bin/install.js

dbug AndroidDriver Getting Java version
info AndroidDriver Java version is: 1.8.0_131
info UiAutomator2 downloading UiAutomator2 Server APK v0.1.8 : https://github.com/appium/appium-uiautomator2-server/releases/download/v0.1.8/appium-uiautomator2-server-v0.1.8.apk
info UiAutomator2 downloading UiAutomator2 Server test APK v0.1.8 : https://github.com/appium/appium-uiautomator2-server/releases/download/v0.1.8/appium-uiautomator2-server-debug-androidTest.apk
info UiAutomator2 UiAutomator2 Server APKs downloaded

also try to update npm:

npm i -g npm

tried to update the npm & reinstall the Appium however the bug remains:
[email protected] install /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver

node ./bin/install.js

dbug AndroidDriver Getting Java version
Could not find JAVA, skipping UiAutomator2 install.

I was finally was able to download Appium with the uiautomato2 successfully.
The bad news is that the error “Error: JAVA_HOME is not set currently. Please set JAVA_HOME.” remains.

When I run the code with uiautomator2 commented out it works while with uiautomator2 it doesn’t find the JAVA_HOME

@menypeled so does JAVA_HOME actually set on your mac/pc?

with mac by default it is:

open bash_profile in terminal with:

  nano ~/.bash_profile

paste following:

export ANDROID_HOME=/Users/jenkinss/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export JAVA_HOME=$(/usr/libexec/java_home)

The bash file was configured as follows (See below):
Do notice that the appium doctor shows that all dependencies were met successfully.
The question is why when I set the capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, “uiautomator2”) the tests will fail with the “Error: JAVA_HOME is not set currently. Please set JAVA_HOME.” while when I comment out this capability all works fine.


export ANDROID_HOME=/Users/menypeled/Library/Android/sdk
export ANDROID_SDK=$ANDROID_HOME
PATH=$PATH:/Applications/apache-ant-1.8.4/bin
PATH=$PATH:/usr/local/share/npm/bin/
PATH=$PATH:$ANDROID_HOME/build-tools
PATH=$PATH:$ANDROID_HOME/platform-tools
PATH=$PATH:$ANDROID_HOME/tools
export PATH=${JAVA_HOME}/bin:$PATH
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:$JAVA_HOME/bin

@menypeled is it working with you?
type in terminal…

$JAVA_HOME/bin/java -version

if it is = i give up :frowning:

java - version command returns:
Menys-MacBook-Pro:~ menypeled$ java -version
java version “1.8.0_111”
Java™ SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot™ 64-Bit Server VM (build 25.111-b14, mixed mode)

However, your command:
Menys-MacBook-Pro:~ menypeled$ JAVA_HOME/bin/java -version
-bash: JAVA_HOME/bin/java: No such file or directory

@menypeled but should work both :slight_smile:

aleks:ios Aleksei$ $JAVA_HOME/bin/java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

aleks:ios Aleksei$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Not sure why it fails.

Hi,
I also getting same issue.
Please give me some hint to solve this.

Thanks a lot

I gave up so working with the old uiautomator API instead of the uiautomator2.

Hopefully it will be fixed on the future versions…

1 Like

I’m having the same issue. Even just using the Appium inspector with that capability, it still fails to find the JAVA_HOME.

Hi @Aleksei
i am also facing the same issue. i have set path variable to
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home"
and path as
export PATH="$JAVA_HOME/bin:$JAVA_HOME/lib:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"

still it gives same isue as Original error: JAVA_HOME is not set currently. Please set JAVA_HOME.

on execution of command which java in terminal it displays
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java

Please help

Hi, here are my paths in bash_profile… please compare with yours-

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
export ANDROID_HOME=/Users//Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin
export PATH=${JAVA_HOME}/bin:$PATH

@Dheeraj_Saxena Thank you so much.I am able to launch the test after setting the path and restrating my mac.

I solved it, by following the instructions when they say not installing appium with sudo. If you have already installed node as sudo (because of dependencies or whatever) and can’t run $ npm install -g appium, this solved it for me https://stackoverflow.com/questions/18088372/how-to-npm-install-global-not-as-root (first answer). After that no more issues (this happened to me because my JAVA_HOME and ANDROID_HOME were set, check if yours are first)