The first thing I tried was to have the same CLI setup as I have on Linux and OS/X and for that I went through
1. Download the MSI installer for nodejs from http://nodejs.org/download/
2. npm did not run from the command line on Windows. It seems that the path settings that the setup made were wrong (showed C:UsersUSERAppDataRoamingnpm) so I changed it to c:Program Filesnodejs which is where node.exe was installed
3. npm install -g cordova

Although the last step above succeeded, I couldn’t get cordova to run from the command line. Tried setting the path to where the cordova module was installed and a bunch of other stuff but to no avail. Eventually I decided to let it go (for now) and compile a cordova project from Visual Studio Express 2012 for Windows Phone 8.

*Edit:* Don’t know what it was that fixed it, but at a certain point I tried issuing cordova from the command prompt and it worked. Perhaps I forgot to relaunch the windows command prompt after changing the path.

Note: (Sept 2014) – mkdir C:UsersUSERAppDataRoamingnpm since it isn’t created when node.js is installed

Make sure to read the next part about running from Visual Studio as it contains some important points and then I’ll continue with the standard method of using the Cordova CLI from windows prompt in the same manner as with Linux and OS/X

To build a cordova project from Visual Studio 2012, I followed the instructions on how to create a Cordova project template on Windows 8 with Visual Studio Express 2012 which are given here:

Follow the above and You’ll be able to compile and deploy your application to your Windows Phone 8 device (I downloaded the latest copy of cordova instead of the phonegap copy they suggested, though it probably makes no difference).

Things you might run in to:

Upon trying to deploy the Cordova sample application to my Lumia 920 from Visual Studio, I got the following error:

Failed to connect to device as it is pin locked.

What the above means is that you have to have the phone open and be able to view the phone desktop in order that Visual Studio will be able to upload the compiled app to your device. For me all this meant was sliding the welcome screen.

I tried deploying again, and this time got:

Failed to connect to device as it is developer locked. For details on developer unlock, visit http://go.microsoft.com/fwlink/?LinkId=195284.

Where they explain how to unlock your phone so you can start uploading Windows Phone 8 applications that you develop. Followed the simple registration steps and after that had no problem uploading the cordova app to Lumia 920.

Back to using the CLI from windows.

So after realizing cordova can now be run from the command line I invoked:

it becomes apparent that on Windows Phone 8 installed testing on Lumia 920, if the frequency of monitoring the compass position is too high then the application freezes. The probability of it freezing seems to be directly related to the frequency in which you monitor the compass heading (either via getCurrentHeading or watchHeading). This is probably a problem with the plugin.

Hopefully, when monitoring the compass position every 1.2 seconds the application will be stable. Since the purpose is to have one codebase for all platforms, you should try and find the highest common denominator that will enable running the target application with the same code base on Android, iOS and WP8.