Invalid server instance exception has occured when using AppiumDriverLocalService on Windows


#1

Hi all,

I’m trying to run Appium from the command line, so i was following this tutorial : Start and Stop Appium Server Programmatically

mAppiumService = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
		     .usingDriverExecutable(new File(appiumNodeFile))
		     .withAppiumJS(new File(appiumJSFile))
		     .withIPAddress(mAppiumServerAddress).usingPort(mAppiumServerPort));

where appiumNodeFile = C:/Program Files (x86)/Appium/node.exe
appiumJSFile = C:/Program Files (x86)/Appium/node_module/appium/bin/appium.js
and mAppiumService is an AppiumDriverLocalService object

I was trying for hours to launch it form the command line ,
Im getting the following error,
Invalid server instance exception has occured: The invalid appium node C:\Program Files (x86)\Appium\node_module\appium\bin\appium.js has been defined

I also set the JS file to C:/Program Files (x86)/Appium/node_module/appium/lib/server/main.js
same error.

Found that post unable-to-start-appium-service-by-appiumdriverlocalserivce it did not help me much.

everything is located within Appium folder under C:\Program Files(x86)\Appium
I use maven , I’ve tried both running it from IDE and CMD, got the same error.

NodeJS is already installed.

any ideas??

Thanks


#2

Getting the same error on Appium 1.5


#3

hi, could someone help with this issue? i have similar problem…

just lost 4 hours of trying to run at least one test successfully, not to mention the problems with appium nuget package itself… i downloaded AppuimDotNetSample solution, updated all nuget packages, installed nodejs, appium, java, whatever was needed. the first problem was “at least one node must be running”, this did help: in apps.cs, add in the beginning of the Init() method:

Environment.SetEnvironmentVariable(AppiumServiceConstants.NodeBinaryPath, @“c:\Program Files (x86)\Appium\node.exe”);
Environment.SetEnvironmentVariable(AppiumServiceConstants.AppiumBinaryPath, @“c:\Program Files(x86)\Appium\Appium.exe”);

however, the result is:
The local appium server has not been started. The given Node.js executable: c:\Program Files (x86)\Appium\node.exe Arguments: “c:\Program Files (x86)\Appium\Appium.exe” --port 4723 --address 127.0.0.1 --launch-timeout 30000 --backend-retries 5.

I’m running on windows server 2012 R2.

it would be very nice to have one simple straightforward example how to run and use this thing…


#4

I mistakenly put a " after the file path and got the same error. This problem has much to do with the file path, like SPACES maybe the cause.
This works for me:
APPIUM_JS_PATH=C:/Users/wlf/AppData/Roaming/npm/node_modules/appium/build/lib/main.js
And the scripts are from: