question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to start Appium server 1.6 programmatically using AppiumDriverLocalService

See original GitHub issue

Description

I’ve installed node via brew then installed Appium 1.6 using NPM and tried running it with AppiumDriverLocalService. I wasn’t able to run Appium server on one of PC.

Environment

Node version 7.0.0 Appium version 1.6.0

Details

It happens on one machine another works well. I checked paths of main.js/appium.js etc. and they are the same on both PCs.

Code To Reproduce Issue

private AppiumDriverLocalService service;
private String serverAddress = "0.0.0.0";

DesiredCapabilities serverCapabilities = new DesiredCapabilities();
AppiumServiceBuilder builder = new AppiumServiceBuilder().withCapabilities(serverCapabilities);
builder.usingAnyFreePort();
builder.withIPAddress(serverAddress);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, "warn");

service = builder.build();
service.start();

Ecxeption stacktraces

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) Buildiat io.appium.java_client.service.local.AppiumServiceBuilder.findNodeInCurrentFileSystem(AppiumServiceBuilder.java:160) at io.appium.java_client.service.local.AppiumServiceBuilder.checkAppiumJS(AppiumServiceBuilder.java:305) at io.appium.java_client.service.local.AppiumServiceBuilder.createArgs(AppiumServiceBuilder.java:386) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:299) at com.***.appium.helper.DriverManager.createAppiumDriver(DriverManager.java:49) at com.autotest.runners.BaseRunner.setUp(BaseRunner.java:77) at com.autotest.runners.advert.AdvertRunner.setUp(AdvertRunner.java:22) at com.autotest.runners.advert.BannerRunner.setUp(BannerRunner.java:22) 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:100) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:169) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108) at org.testng.TestRunner.privateRun(TestRunner.java:753) at org.testng.TestRunner.run(TestRunner.java:607) at org.testng.SuiteRunner.runTest(SuiteRunner.java:368) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:363) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:321) at org.testng.SuiteRunner.run(SuiteRunner.java:270) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1284) at org.testng.TestNG.runSuitesLocally(TestNG.java:1209) at org.testng.TestNG.runSuites(TestNG.java:1124) at org.testng.TestNG.run(TestNG.java:1096) at com.autotest.Launcher.main(Launcher.java:72) Caused by: java.io.IOException: /usr/local/lib/node_modules /var/folders/wk/w9dbkg0x7gbdbcmr2c9pfwnw0000gn/T/get_path_to_default_node5052055597677988693.sh: line 4: shell_session_update: command not found

at io.appium.java_client.service.local.AppiumServiceBuilder.findNodeInCurrentFileSystem(AppiumServiceBuilder.java:161)
... 30 more

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
SrinivasanTargetcommented, Oct 28, 2016

@shynkevich-alex Please try setting up the main.js path as well and update us,

AppiumServiceBuilder builder = new AppiumServiceBuilder()
                .withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js"))
                .withArgument(GeneralServerFlag.APP,  path of your app );
        appiumDriverLocalService = builder.build();
        appiumDriverLocalService.start();

Also were you able to run the server manually? Is path of node is setup in PATH on your PC?

0reactions
varthikeyancommented, Sep 18, 2020

I am getting below error in “service.start()”. Someone please help?

(node:1400) Warning: To load an ES module, set “type”: “module” in the package.json or use the .mjs extension. C:\Users\HP\AppData\Roaming\npm\node_modules\appium\lib\main.js:4 import { init as logsinkInit } from ‘./logsink’; ^^^^^^

SyntaxError: Cannot use import statement outside a module at wrapSafe (internal/modules/cjs/loader.js:1053:16) at Module._compile (internal/modules/cjs/loader.js:1101:27) 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to start appium service by AppiumDriverLocalSerivce
Hi Guys, Now i am trying to use page object model to design my selenium + appium framework. I wan to start the...
Read more >
How to run appium server programmatically (appium 1.6.5)
Hello, everyone I have tried the code below to run the appium server programmatically.But not able to do so AppiumDriverLocalService service ...
Read more >
Start appium server programmatically with iPhone is failing
When I start the appium server via terminal tests run successfully. ... Appium - 1.6.4 beta ... public AppiumDriverLocalService startAppiumService() {
Read more >
Start the appium server from code with ...
I am trying to start the Appium server programmatically as follows: AppiumDriverLocalService service = AppiumDriverLocalService.
Read more >
Launching and stopping appium server programmtically
I am trying to start appium server through java code but getting ... I was able to start up the appium server programmatically...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found