Not creating session with Emulator

Getting error “A new session could not be created. (Original error: Requested a new session but one was in progress) (WARNING: The server did not provide any stacktrace information)”

I had restarted the Appium before I run the script. It took a lot time and at fail it thrown me the above message.

Trying to launch app in Emulator with “AppiumForWindows-1.2.4.1”.

Following is the code:

package mobileOne;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.;
import org.testng.
;

public class whatsappTest {

WebDriver driver = null;
@BeforeTest
public void atStart() throws MalformedURLException, InterruptedException

{    

    File app = new File("D:\\APKs\\5767.apk");

    DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
    capabilities.setCapability("deviceName", "Nexus");
    capabilities.setCapability("platformVersion", "4.4.2");
    //capabilities.setCapability(CapabilityType.VERSION, "4.1.2");

    capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");

    capabilities.setCapability("platformName", "Android");
    //capabilities.setCapability(CapabilityType.PLATFORM, "Android");

    capabilities.setCapability("app", app.getAbsolutePath());

    capabilities.setCapability("appPackage", "com.mlsdev.drive2day"); //Replace with your app's package
    capabilities.setCapability("appActivity", "com.mlsdev.drive2day.ui.activity.MainActivity"); //Replace with app's Activity

    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
@Test
public void testCase()
{
    driver.findElement(By.name("Weather")).click();
}
@AfterTest
    public void atEnd()
{
driver.quit();
}

}

USB debugging is enabled in the emulator

More details:
Using Appium java client 2.0.0
AppiumForWindows-1.2.4.1
Eclipse - eclipse-jee-juno-SR2-win32-x86_64

Please let me know what am I doing wrong.

There is no error in the code above but the node.js was not installed on the machine.
PLZ do download .msi for windows and not the exe from the nodejs.org
The wrong directions from one of the mobile automation training website wasted my 4 days to figure this out.

Can you please explain in details how did you fix this issue? I mean how is that installing NODE.JS msi fixed - "A new session could not be created. (Original error: Requested a new session but one was in progress) error?

Thanks
Abhay

@ Abhay: I just had a review on per-requisites for appium, where I found running node.js exe seemed doubtful; hence I installed node.js msi and (hurray) it worked.
You may try it.

Regards,
Nitin