try to start the server like this, not by giving node path in cmd.
private static AppiumDriverLocalService service;
private static Logger log = LogManager.getLogger(AppiumSetup.class.getName());
public static void startServer(){
AppiumServiceBuilder builder;
log.info("Building and starting the server:");
builder = new AppiumServiceBuilder();
builder.usingPort(4723);
builder.withCapabilities(capabilities);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, LogLevel);
service = AppiumDriverLocalService.buildService(builder);
service.start();
log.info("Server started on Port - " + 4723);
}
public static void stopServer() {
try {
log.info("Trying to stop the server...");
service.stop();
log.info("Success, Server stopped.");
} catch (Exception e) {
log.info("Appium server could not be stopped.");
}
}