Main.js: error: argument "--app": Expected one argument. null

Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --app --platform-name Android --platform-version 21 --automation-name Appium --log-no-color
usage: main.js [-h] [-v] [–shell]
[–localizable-strings-dir LOCALIZABLESTRINGSDIR] [–app APP]
[–ipa IPA] [-U UDID] [-a ADDRESS] [-p PORT]
[-ca CALLBACKADDRESS] [-cp CALLBACKPORT] [-bp BOOTSTRAPPORT]
[-k] [-r BACKENDRETRIES] [–session-override] [–full-reset]
[–no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors]
[-G WEBHOOK] [–native-instruments-lib]
[–app-pkg ANDROIDPACKAGE] [–app-activity ANDROIDACTIVITY]
[–app-wait-package ANDROIDWAITPACKAGE]
[–app-wait-activity ANDROIDWAITACTIVITY]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD]
[–avd-args AVDARGS]
[–device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [–safari]
[–device-name DEVICENAME] [–platform-name PLATFORMNAME]
[–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME] [–browser-name BROWSERNAME]
[–default-device] [–force-iphone] [–force-ipad]
[–language LANGUAGE] [–locale LOCALE]
[–calendar-format CALENDARFORMAT] [–orientation ORIENTATION]
[–tracetemplate AUTOMATIONTRACETEMPLATEPATH]
[–instruments INSTRUMENTSPATH] [–show-sim-log]
[–show-ios-log] [–nodeconfig NODECONFIG] [-ra ROBOTADDRESS]
[-rp ROBOTPORT] [–selendroid-port SELENDROIDPORT]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE]
[–use-keystore] [–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–show-config] [–no-perms-check]
[–command-timeout DEFAULTCOMMANDTIMEOUT] [–keep-keychains]
[–strict-caps] [–isolate-sim-device] [–tmp TMPDIR]
[–trace-dir TRACEDIR] [–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY] [–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS]
[–dont-stop-app-on-reset] [–debug-log-spacing]
[–suppress-adb-kill-server] [–async-trace]

main.js: error: argument “–app”: Expected one argument. null

Appium server process ended

Hi Every one, today i got a new issue , Today my appium server not working properly so plz help me and how to rectify this problem .

I’m using windows 7 os,jdk7,

Thanks & Regards
Goutham G

I’m using AppiumForWindows_1_4_13_1

The error here says it all. You did not provide an argument to --app:

Read this for more info:

http://appium.io/slate/en/master/?java#server-arguments

Hi wreed ,

First of all i would you like to thanks for the kind information but i’m faced the same error still today.

Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --app D:.apk file\base.apk --platform-name Android --platform-version 21 --automation-name Appium --log-no-color
usage: main.js [-h] [-v] [–shell]
[–localizable-strings-dir LOCALIZABLESTRINGSDIR] [–app APP]
[–ipa IPA] [-U UDID] [-a ADDRESS] [-p PORT]
[-ca CALLBACKADDRESS] [-cp CALLBACKPORT] [-bp BOOTSTRAPPORT]
[-k] [-r BACKENDRETRIES] [–session-override] [–full-reset]
[–no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors]
[-G WEBHOOK] [–native-instruments-lib]
[–app-pkg ANDROIDPACKAGE] [–app-activity ANDROIDACTIVITY]
[–app-wait-package ANDROIDWAITPACKAGE]
[–app-wait-activity ANDROIDWAITACTIVITY]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD]
[–avd-args AVDARGS]
[–device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [–safari]
[–device-name DEVICENAME] [–platform-name PLATFORMNAME]
[–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME] [–browser-name BROWSERNAME]
[–default-device] [–force-iphone] [–force-ipad]
[–language LANGUAGE] [–locale LOCALE]
[–calendar-format CALENDARFORMAT] [–orientation ORIENTATION]
[–tracetemplate AUTOMATIONTRACETEMPLATEPATH]
[–instruments INSTRUMENTSPATH] [–show-sim-log]
[–show-ios-log] [–nodeconfig NODECONFIG] [-ra ROBOTADDRESS]
[-rp ROBOTPORT] [–selendroid-port SELENDROIDPORT]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE]
[–use-keystore] [–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–show-config] [–no-perms-check]
[–command-timeout DEFAULTCOMMANDTIMEOUT] [–keep-keychains]
[–strict-caps] [–isolate-sim-device] [–tmp TMPDIR]
[–trace-dir TRACEDIR] [–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY] [–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS]
[–dont-stop-app-on-reset] [–debug-log-spacing]
[–suppress-adb-kill-server] [–async-trace]

main.js: error: Unrecognized arguments: file\base.apk.

Appium server process ended

thanks everyone , i did a small mistake please check the folder name apk file and correct it apkfile as a folder name in your local machine (appium does not support the gaps in folder name i think it is one of the bug)

I’m glad you were able to fix the error. I think the path with a space would work if you quoted the string.

ok i will try and any way thank you for your support

Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --app --platform-name Android --platform-version 23 --automation-name Appium --log-no-color

usage: main.js [-h] [-v] [–shell]
main.js: error: argument “–app”: Expected one argument. null
[–localizable-strings-dir LOCALIZABLESTRINGSDIR] [–app APP]
[–ipa IPA] [-U UDID] [-a ADDRESS] [-p PORT]
[-ca CALLBACKADDRESS] [-cp CALLBACKPORT] [-bp BOOTSTRAPPORT]
[-k] [-r BACKENDRETRIES] [–session-override] [–full-reset]
[–no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors]
[-G WEBHOOK] [–native-instruments-lib]
[–app-pkg ANDROIDPACKAGE] [–app-activity ANDROIDACTIVITY]
[–app-wait-package ANDROIDWAITPACKAGE]
[–app-wait-activity ANDROIDWAITACTIVITY]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD]
[–avd-args AVDARGS]
[–device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [–safari]
[–device-name DEVICENAME] [–platform-name PLATFORMNAME]
[–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME] [–browser-name BROWSERNAME]
[–default-device] [–force-iphone] [–force-ipad]
[–language LANGUAGE] [–locale LOCALE]
[–calendar-format CALENDARFORMAT] [–orientation ORIENTATION]
[–tracetemplate AUTOMATIONTRACETEMPLATEPATH]
[–instruments INSTRUMENTSPATH] [–show-sim-log]
[–show-ios-log] [–nodeconfig NODECONFIG] [-ra ROBOTADDRESS]
[-rp ROBOTPORT] [–selendroid-port SELENDROIDPORT]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE]
[–use-keystore] [–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–show-config] [–no-perms-check]
[–command-timeout DEFAULTCOMMANDTIMEOUT] [–keep-keychains]
[–strict-caps] [–isolate-sim-device] [–tmp TMPDIR]
[–trace-dir TRACEDIR] [–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY] [–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS]
[–dont-stop-app-on-reset] [–debug-log-spacing]
[–suppress-adb-kill-server] [–async-trace]

Appium server process ended

Pls resolve this issue. I’m using win 10 OS

Get rid of the app parm if you are not going to specify it

I had too come across the same error. Tried unchecking the Application Path checkbox under Android Settings & then launching the Appium Node Server . It worked for me

Hi all,

I got an error while using the method to start appium server:
appium.js: error: argument “–nodeconfig”: Expected one argument. null

The code is as below:
cap = new DesiredCapabilities();
cap.setCapability(“noReset”, “false”);
cap.setCapability(“deviceName”, deviceUDID);
// cap.setCapability(“platformVersion”, “5.1.1”);
cap.setCapability(“platformName”, “Android”);
cap.setCapability("–nodeconfig", “”);

		System.out.println("After calling buildService: ");
		File classPathRoot = new File(System.getProperty("user.dir"));
		String osName = System.getProperty("os.name");
		service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
				.usingDriverExecutable(new File(appiumInstallationDir + File.separator + "nodejs" + File.separator + "node.exe"))
				.withAppiumJS(new File(appiumInstallationDir + " (x86)" + File.separator + "Appium" + File.separator
						+ "node_modules" + File.separator + "appium" + File.separator + "bin" + File.separator + "appium.js"))
				.withIPAddress(address)
				//.withArgument(GeneralServerFlag.ROBOT_ADDRESS, deviceUDID)
				.withArgument(GeneralServerFlag.ROBOT_PORT, devicePort)
				.usingPort(Integer.parseInt(serverPort))
				.withStartUpTimeOut(20, TimeUnit.SECONDS)
				.withCapabilities(cap)
				.withArgument(GeneralServerFlag.SESSION_OVERRIDE)
				.withArgument(GeneralServerFlag.LOG_LEVEL,"error")
				.withArgument(GeneralServerFlag.CONFIGURATION_FILE, "")
				.withLogFile(new File(new File(classPathRoot, File.separator + "log"), "androidLog.txt")));
		if(! service.isRunning()){
			service.start();
			appiumServiceUrl = service.getUrl().toString();
			System.out.println("Try appiumServiceUrl: "+appiumServiceUrl);
		}

Can anyone please tell me where I am wrong.

You know that’s not null, right? It’s an empty string.

Yeah, but when I did not give this capability, I got the mentioned error. Actually, I am not sure what value to give here in nodeconfig. Thanks for the reply :slight_smile:

Hi all, I am getting some error on running appium server:

The code is as below:

try {
//Set Capabilities
cap = new DesiredCapabilities();
cap.setCapability(“noReset”, “false”);
cap.setCapability(“deviceName”, deviceUDID);
cap.setCapability(“platformVersion”, version);
cap.setCapability(“automationName”, “UiAutomator2”);
cap.setCapability(“platformName”, “Android”);
cap.setCapability(“appPackage”, appPackage);
cap.setCapability(“appActivity”, appActivity);

		//cap.setCapability("--nodeconfig", "");
		
		System.out.println("After calling buildService: ");
		File classPathRoot = new File(System.getProperty("user.dir"));
		String osName = System.getProperty("os.name");
		service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
				.usingDriverExecutable(new File(appiumInstallationDir + File.separator + "nodejs" + File.separator + "node.exe"))
				.withAppiumJS(new File(appiumInstallationDir + " (x86)" + File.separator + "Appium" + File.separator
						+ "node_modules" + File.separator + "appium" + File.separator + "bin" + File.separator + "appium.js"))
				.withIPAddress(address)
				//.withArgument(GeneralServerFlag.ROBOT_ADDRESS, deviceUDID)
				.withArgument(GeneralServerFlag.ROBOT_PORT, devicePort)
				.usingPort(Integer.parseInt(serverPort))
				.withStartUpTimeOut(20, TimeUnit.SECONDS)
				.withCapabilities(cap)
				.withArgument(GeneralServerFlag.SESSION_OVERRIDE)
				.withArgument(GeneralServerFlag.LOG_LEVEL,"error")
				.withArgument(GeneralServerFlag.CONFIGURATION_FILE, "")
				.withLogFile(new File(new File(classPathRoot, File.separator + "log"), "androidLog.txt")));
		if(! service.isRunning()){
			service.start();
			appiumServiceUrl = service.getUrl().toString();
			System.out.println("Try appiumServiceUrl: "+appiumServiceUrl);
		}
		
	} catch (Exception e) {
		e.printStackTrace();
		appiumServiceUrl = service.getUrl().toString();
		System.out.println("Catch appiumServiceUrl: "+appiumServiceUrl);
		service.stop();
		//service.stop();
	}

And I’m getting error as below:

io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: C:\Program Files\nodejs\node.exe Arguments: [C:\Program Files (x86)\Appium\node_modules\appium\bin\appium.js, --port, 4723, --address, 127.0.1.0, --log, C:\Users<UserName><Project>\log\androidLog.txt, --log-level, error, --robot-port, 4726, --nodeconfig, --session-override, --default-capabilities, {“appPackage”: “”, “appActivity”: “”, “noReset”: “false”, “platformVersion”: “”, “automationName”: “UiAutomator2”, “platformName”: “Android”, “deviceName”: “”}]
Process output: usage: appium.js [-h] [-v] [–shell]
[–localizable-strings-dir LOCALIZABLESTRINGSDIR] [–app APP]
[–ipa IPA] [-U UDID] [-a ADDRESS] [-p PORT]
[-ca CALLBACKADDRESS] [-cp CALLBACKPORT] [-bp BOOTSTRAPPORT]
[-k] [-r BACKENDRETRIES] [–session-override] [–full-reset]
[–no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors]
[-G WEBHOOK] [–native-instruments-lib]
[–app-pkg ANDROIDPACKAGE] [–app-activity ANDROIDACTIVITY]
[–app-wait-package ANDROIDWAITPACKAGE]
[–app-wait-activity ANDROIDWAITACTIVITY]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD]
[–avd-args AVDARGS]
[–device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [–safari]
[–device-name DEVICENAME] [–platform-name PLATFORMNAME]
[–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME]
[–browser-name BROWSERNAME] [–default-device]
[–force-iphone] [–force-ipad] [–language LANGUAGE]
[–locale LOCALE] [–calendar-format CALENDARFORMAT]
[–orientation ORIENTATION]
[–tracetemplate AUTOMATIONTRACETEMPLATEPATH]
[–instruments INSTRUMENTSPATH] [–show-sim-log]
[–show-ios-log] [–nodeconfig NODECONFIG] [-ra ROBOTADDRESS]
[-rp ROBOTPORT] [–selendroid-port SELENDROIDPORT]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE]
[–use-keystore] [–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–show-config]
[–no-perms-check] [–command-timeout DEFAULTCOMMANDTIMEOUT]
[–keep-keychains] [–strict-caps] [–isolate-sim-device]
[–tmp TMPDIR] [–trace-dir TRACEDIR]
[–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY]
[–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS]
[–dont-stop-app-on-reset] [–debug-log-spacing]
[–suppress-adb-kill-server] [–async-trace]

appium.js: error: argument “–nodeconfig”: Expected one argument. null

Even on uncommenting the ‘cap.setCapability("–nodeconfig", “”);’, I’m still getting the same error.
I’m trying to use the buildService method to start a server, but not exactly sure what arguments to give for the nodeconfig and its syntax. Any idea why this is happening ?
Any help is appreciated ! Thanks …

I did a Google search on setting up Appium on Windows (full disclosure: I don’t use Windows) and found this pretty complete tutorial on setting Appium up on Windows. It talks about 3 different methods for starting Appium programatically. What’s interesting is that your code seems to follow the first technique code wise, for example using the AppiumServiceBuilder, but using the Appium Gui as the target, which is the second technique. Could you read through this and possibly try to follow the second technique if you insist on using the Gui, or use the code you have but install Appium vi NPM? I think reading through this and following the guidance will get Appium up and running for you:

Hi @wreed, thanks a lot for the help. It means a lot to me :slight_smile:

I am presently looking into the second method as you suggested, parallely I’ve tried uninstalling the previous version of appium (1.4.61) and installed appium (1.6.2). After doing that, when I tried to run the script, I got another error for ‘service.start();’ :

io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: C:\Program Files\nodejs\node.exe Arguments: [C:\Program Files (x86)\Appium\Resources\app\node_modules\appium\build\lib\appium.js, --port, 4723, --address, 127.0.1.0, --log, C:\Users<user><project-folder>\log\androidLog.txt, --log-level, error, --robot-port, 4726, --nodeconfig, --session-override, --default-capabilities, {“appPackage”: “”, “appActivity”: “”, “noReset”: “false”, “platformVersion”: “”, “automationName”: “UiAutomator2”, “platformName”: “Android”, “deviceName”: “”}]

at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:155)
at com.testbase.TestInit.startServer(TestInit.java:284)
at com.testbase.TestInit.beforeTest(TestInit.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
at org.testng.TestRunner.beforeRun(TestRunner.java:626)
at org.testng.TestRunner.run(TestRunner.java:594)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at testng.TestNGRunner2.main(TestNGRunner2.java:201)

Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://127.0.1.0:4723/wd/hub/status] to be available after 20062 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
at io.appium.java_client.service.local.AppiumDriverLocalService.ping(AppiumDriverLocalService.java:115)
at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:142)
… 23 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:166)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80)
… 25 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:154)
… 26 more

I think the appium server is spun up, and I’ve given the ‘.withStartUpTimeOut(120, TimeUnit.SECONDS)’. Also, I’m trying to connect multiple devices to the PC and run the scripts. So I need to spun multiple appium servers up.
Again, thanks for your concern … Meanwhile I’m trying the 2nd method and will update you here …

Total guess here, but I would address this first thing. Could the server be timing out because it can’t write a log to this non path?

Second and third things to address.

Hi @wreed, thanks for the reply, hope you are doing good :slight_smile:
I kept the 1st method of starting appium servers aside, and I tried the second method and am successfully able to start up the appium server.

Thanks for your support …

1 Like