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

io.appium.java_client.service.local.InvalidServerInstanceException: There is no installed nodes! #114

Closed
arunkumar-muthusamy opened this issue Oct 16, 2019 · 3 comments

Comments

@arunkumar-muthusamy
Copy link

arunkumar-muthusamy commented Oct 16, 2019

Hi,

I'm getting following exception while initializing the new driver AndroidDriver<MobileElement> androidDriver = new AndroidDriver(new URL(deviceFarmUrl), capabilities);

Everything was working well until end of last month. We didn't change anything in our end (other than we had Jenkins upgrade recently). BTW, the containers are provisioned runtime by Jenkins on Kube.

I understand, It is not an appium issue. I'm posting this to get some help from community.

Please let me know if i'm missing anything

Error from Test:

io.appium.java_client.service.local.InvalidServerInstanceException: Invalid server instance exception has occured: There is no installed nodes! Please install node via NPM (https://www.npmjs.com/package/appium#using-node-js) or download and install Appium app (http://appium.io/downloads.html)
at io.appium.java_client.service.local.AppiumServiceBuilder.findNodeInCurrentFileSystem(AppiumServiceBuilder.java:184)
at io.appium.java_client.service.local.AppiumServiceBuilder.checkAppiumJS(AppiumServiceBuilder.java:345)
at io.appium.java_client.service.local.AppiumServiceBuilder.createArgs(AppiumServiceBuilder.java:425)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:358)
at io.appium.java_client.service.local.AppiumDriverLocalService.buildService(AppiumDriverLocalService.java:86)
...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:40)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:489)
at org.testng.internal.thread.ThreadUtil$1.call(ThreadUtil.java:52)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: mesg: ttyname failed: Inappropriate ioctl for device
/usr/lib/node_modules

at io.appium.java_client.service.local.AppiumServiceBuilder.findNodeInCurrentFileSystem(AppiumServiceBuilder.java:185)
... 27 more

Inside the Container:

$ node -v
 v10.16.3

$ appium -v
 1.14.2

$ echo $PATH
 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
@arunkumar-muthusamy
Copy link
Author

I solved it on my own. Providing the answer here for those land here from google search...

It seems in the appium java client, the default path for appium main.js is /usr/local/lib/node_modules/appium/build/lib/main.js. But in the appium-docker-android container, it is located in /usr/lib/node_modules/appium/build/lib/main.js.

So, to fix this. Initialize the AppiumServiceBuilder with the path to appiumJs. See the code example below,

AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder().withAppiumJS(new File("/usr/lib/node_modules/appium/build/lib/main.js"));
AppiumDriverLocalService appiumDriverLocalService = AppiumDriverLocalService.buildService(serviceBuilder);

@mykola-mokhnach
Copy link

This might a problem with docker image config. Java client tries to detect node modules root by executing bash -l get_path_to_default_node.sh script, which internally executes npm root -g command. So, if any of these commands does not return a correct result then it fails with the error above.

cc @budtmo

@arunkumar-muthusamy
Copy link
Author

@mykola-mokhnach Thanks for the insight!

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

2 participants