nicholas
nicholas

Reputation: 2770

Appium: Exception: Invalid server instance exception has occured: There is no installed nodes

I tried to start the appium server programmatically but encounter error. How to resolve this issues? I have nodejs installed and appium installed and environemnt variable set properly. I"m using maven appium java client 6.1.0 and selenium 3.14.0. Please help. A billion thanks for your help.

Code:

try {
            File appDir = new File(System.getProperty("user.dir"));
            File app = new File(appDir, "..\\apk\\Flipkart.apk");

            // apk Capabilities
            DesiredCapabilities caps = new DesiredCapabilities();
            caps.setCapability("deviceName", "Sony Xperia Z2");
            caps.setCapability("BROWSER_NAME", "Android");
            caps.setCapability("platformVersion", "6.0");
            caps.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID);
            //caps.setCapability("udid", "WUJ01N4RQ3"); // DeviceId from "adb devices" command
            caps.setCapability("platformName", "Android");
            caps.setCapability("app", app.getAbsolutePath());
            caps.setCapability("appPackage", "com.flipkart.android");
            caps.setCapability("appActivity","com.flipkart.android.SplashActivity");

            // Appium Capabilities
            caps.setCapability("skipUnlock","true");
            caps.setCapability("noReset","false");

            appiumBuilder = new AppiumServiceBuilder();
            appiumBuilder.withIPAddress("127.0.0.1");
            appiumBuilder.usingPort(47233);
            appiumBuilder.withCapabilities(caps);
            appiumBuilder.withStartUpTimeOut(3, TimeUnit.MINUTES);
            appiumBuilder.withLogFile(new File(System.getProperty("user.dir") + "\\log\\appium.log"));
            appiumBuilder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
            appiumBuilder.withArgument(GeneralServerFlag.LOG_LEVEL, "DEBUG");
            appiumBuilder.withArgument(GeneralServerFlag.ASYNC_TRACE, "true");

            appiumServer = AppiumDriverLocalService.buildService(appiumBuilder);
            appiumServer.start();
            //new URL("http://127.0.0.1:47233/wd/hub")
            driver = new AndroidDriver<MobileElement>(appiumServer, caps);
            driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

        } catch (Exception ex) {
            LogManager.logger.log(Level.INFO, "Exception: " + ex.getMessage());
        }

Error Log:

INFO: Exception: 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) Jan 03, 2019 3:52:12 PM com.peterwkc.testManager.AndroidManager tearDown INFO: Exception: null

EDIT: I believe appium source code cannot detect my installation of nodejs and appium.

Upvotes: 8

Views: 12277

Answers (4)

user3780373
user3780373

Reputation:

• Sometimes, when using Node Version Manager like nvm being used to install and maintain node and npm, you may need to download and install the same or higher version of node/npm being downloaded(in pkg form) from nodejs.org and update your PATH accordingly.

Upvotes: 0

Huy H&#243;m Hỉnh
Huy H&#243;m Hỉnh

Reputation: 617

I got the same problem when using nvm although node already installed on all versions.

Finally, I decided to uninstall nvm and it's worked with the only node version

Upvotes: 0

Appu Mistri
Appu Mistri

Reputation: 853

Try installing Appium globally. This resolved the issue for me.

npm install -g appium

Upvotes: 7

VSB
VSB

Reputation: 327

I faced the same issue at my end

  1. Try to run the node server instance from command line, just type "node" and enter -- server should get started
  2. Open another terminal window and just check if all details are been going good for the process running by doing "ps eww"
  3. The node process running should be displayed here
  4. Just kill the "node server", by typing "Killall node" on the same command window you did "ps eww"
  5. The "node"window will show the process terminated.

Time for the truth, run your script and all should get going smoothly

I did this with appium - 1.9.0 node - 11.9.0 npm version - 6.5.0 testscript - Java tool - Eclipse platform - iOS (10.14)

Upvotes: 0

Related Questions