[windows] Phonegap Cordova installation Windows

The documentation for phonegap/cordova is absolutely horrible. All I'm trying to do is install PhoneGap 3.0 on my Windows environment but having no success.

Below are my steps and points of failure. Can anyone advise on solutions?

According to the instructions:

  1. Install Node.js (SUCCESSFUL)
  2. From nodes.js: install -g cordova (SUCCESSFUL)
  3. Add Platform: cordova platform add wp8 (NOTHING HAPPENS)
  4. Try with phonegap: phonegap install wp8 (ERROR project directory could not be found)

From "Windows Phone 8 platform guide"

  1. Install Windows SDK (SUCCESSFUL)
  2. "Download and extract the latest copy of [PhoneGap. You will be working in the lib\windows-phone-8\wp8 subfolder, lib\windows-phone-8\wp7 contains the Windwos Phone 7 version of Cordova"

HUH?!?! What location is the directory in?!?! So I've found the undocumented phonegap directory buried in AppData\Local... and there IS a libs directory but there certainly is NOT any WP8 subfolders. Where would one install that from? Presumably the add platform command above, but add that simply returns me to a new command prompt.

Tried using the phonegap command: phonegap plaform add wp8

ERROR - 'platform add wp8" is not a node.

I get its open source but this is brutal spaghetti reference documentation. If anyone has been able to successfully install 3.0 for WP8 any pointers would be help.

This question is related to windows cordova

The answer is


I had same issue but finally i got success by doing this please go throw this image Plase Run all the command in the PHONE TOOL COMMAND PROMPT enter image description here


In C:\phonegap-2.9.0\lib\windows-phone-8 there's a batch file called createTemplates.bat. You need to execute this file, which will create the CordovaWP8_2_9_0.zip file mentioned in their docs.


I had the same problem. I lost hours, then I saw that version of node.js installed was 0.8. But I downloaded and installed version 0.10 from node.js website.

I downloaded and installed again, and now version is 0.10. Result: PhoneGap has been sucessfully installed with this version.


I faced this same error too. And i even tried downloading the PhoneGap master from GitHub,but i found out that what i got was Phonegap 2.9. I eventually had to download the Cordova 3 Source

Follow this steps to get it.

  1. Download and unzip the Cordova 3 Source
  2. Run the template.bat in the cordova-wp8 folder
  3. Copy the generated Zip files to your Visual studio template folder

I have found this Multi-Device Hybrid Apps for Visual Studio Documentation for CTP1.1 Last updated: May 29, 2014 .

Some of the content from the documentation as follows.

This release supports building apps for the following device targets:

Android 4+ (4.4 providing the optimal developer experience) iOS 6 & 7 Windows 8.0 (Store) Windows Phone 8.0

Requirements: Windows 8.1

Visual Studio 2013 Update 2 - Professional, Ultimate, or Premium with the following optional features installed:

Tools for Maintaining Store apps for Windows 8 Windows Phone 8.0 SDK

Additional system requirements vary by device platform:

The Android emulator works best with PCs capable of installing the Intel HAXM driver

Windows Phone 8 requires a Hyper-V capable PC to run the emulator Building for iOS and using the iOS Simulator requires a Mac capable of running Xcode 5.1

Third Party Dependencies :

Joyent Node.js – Enables Visual Studio to integrate with the Apache Cordova Command Line Interface (CLI) and Apache Ripple™ Emulator Git CLI – Required only if you need to manually add git URIs for plugins

Google Chrome – Required to run the Apache Ripple emulator for iOS and Android

Apache Ant 1.8.0+ – Required as a dependency for the Android build process

Oracle Java JDK 7 – Required as a dependency for the Android build process

Android SDK – Required as a dependency for the Android build process and Ripple

SQLLite for Windows Runtime – required to add SQL connectivity to Windows apps (for the WebSQL Polyfill plugin)

Apple iTunes – Required for deploying an app to an iOS device connected to your Windows PC

enter image description here


I was having issues wtih installing phonegap. The issues were fixed when i run cmd as Administrator and then run command

npm install -g phonegap

and it is installed successfully.

Then in the directory where it is installed i opened cmd, and run command phonegap and it was working fine. Now going to play with it more :)

Thanks buddies for all this help.


This answer was first posted here: cordova/phonegap does not make android directory

With the release of Cordova 3.3.0, it seems the PhoneGap team is trying to address the naming confusion. The documentations have been updated to recommend people using the cordova command instead. Do not use the phonegap command anymore.

Here is a fresh installation guide for a guaranteed trouble free set up:

  1. Install Cordova (forget the name PhoneGap from now on). For PC:

    C:> npm install -g cordova

  2. From command prompt, navigate to the folder you want to create your project using:

    cordova create hello com.example.hello HelloWorld
    cd hello

  3. Define the OS you want to suppport for example:

    cordova platform add wp8

  4. Install plugins (If needed). For example we want the following:

    cordova plugin add org.apache.cordova.device
    cordova plugin add org.apache.cordova.camera
    cordova plugin add org.apache.cordova.media-capture
    cordova plugin add org.apache.cordova.media
    

  5. Finally, generate the app using:
    cordova build wp8

Here is a link to the PhoneGapCordova 3.3.0 Documentation http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface


Phonegap Cordova Installation on Windows

Requirements

  • Eclipse + ADT Plugin
  • Android SDK Tool
  • Android Platform Tools
  • Latest PhoneGap zip folder. Extract its contents.

Supported Android Devices

Android 2.2 Android 2.3 Android 4.x Phonegap Cordova Installation

Set PATH environment variable for android

  1. From desktop, right click My Computer and click Properties.

  2. Click Advance System Settings link in the left column.

  3. In the system properties window click the environment variables button.

  4. Select the PATH variable from the System variables section. Select the Edit button. You need to add the path to your Android SDK platform-tools and tools directory. For Example: D:\adt-bundle-windows-x86_64-20130219\sdk\platform-tools;D:\adt-bundle-windows-x86_64-20130219\sdk\tools Save your Edit. Close the Environment Variable dialog.

  5. Additionally, you may need to include %JAVA_HOME%\bin to your PATH as well. To check to see if this is required run a command prompt and type java. If the program could not be found add %JAVA_HOME%\bin to the PATH. You may need to specify the full path instead of using %JAVA_HOME% environment variable.
  6. Finally, you may need to include %ANT_HOME%\bin to your PATH as well. To check to see if this is required run a command prompt and type ant. If program cannot be found then add %ANT_HOME%\bin to the PATH. You may need to specify the full path instead of using the %ANT_HOME% environment variable. Set-up New Project

Open Command Prompt, navigate to bin directory within the android sub-folder of the Cordova distribution.

Type in: ./create

Then press Enter.Launch Eclipse. In File Menu Item and select to Import…

Import Select “Existing Android Code into Workspace” and click ‘Next >’.

Browse the project created through command prompt. And click ‘Finish’. Deploy to Emulator From within Eclipse, press this toolbar icon.

Once open, the Android SDK Manager displays various runtime libraries Install the APIs as per requirement from here. From within Eclipse, press this toolbar icon.

Choose and device definition from the list which comes. (There is only one item in the current list.) Press New… in the above window to create new Android Virtual Device(AVD) and use it to run your project.

To open the emulator as a separate application, Select the AVD and press Start. It launches much as it would on device, with additional controls available for hardware buttons:

Deploy to Device:

Make sure USB debugging is enabled on your device and plug it into your system. Right Click the Project and go to Run As > Android Application.

Read more ...


I too struggled a lot with phonegap steps.

The correct documentation is at the following link. http://docs.phonegap.com/en/edge/guide_cli_index.md.html

There is no more cordova command, It is replaced with phonegap.


I faced the same problem and struggled for an hour to get pass through by reading the documents and the other issues reported in Stack Overflow but I didn't find any answer to it. So, here is the guide to successfully run the phonegap/cordova in Windows Machine.

Follow these steps

  1. Download and Install node.js from http://nodejs.org/
  2. Run the command npm install -g phonegap (in case of phonegap installation) or run the command npm install -g cordova (in case of Cordova installation).
  3. As the installation gets completed you can notice this:

    C:\Users\binaryuser\AppData\Roaming\npm\cordova -> C:\Users\binaryuser\AppData\Roaming\npm\node_modules\cordova\bin\cordova
    [email protected] C:\Users\binaryuser\AppData\Roaming\npm\node_modules\cordova
    +-- [email protected]
    +-- [email protected]
    +-- [email protected]
    +-- [email protected]
    +-- [email protected]
    +-- [email protected] ([email protected])
    +-- [email protected] ([email protected])
    +-- [email protected] ([email protected], [email protected])
    +-- [email protected] ([email protected], [email protected])
    +-- [email protected] ([email protected], [email protected])
    +-- [email protected] ([email protected], [email protected])
    +-- [email protected] ([email protected], [email protected], [email protected])
    +-- [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
    +-- [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
    +-- [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
    +-- [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
    +-- [email protected]
    +-- [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
    
  4. Notice the above line you can see the path were the file is mentioned. Copy that path. In my case it is C:\Users\binaryuser\AppData\Roaming\npm\cordova so use cd C:\Users\binaryuser\AppData\Roaming\npm\ and type cordova. There it is, it finally works.

  5. Since the -g key value isn't working you have set the Environment Variables path:
    1. Press Win + Pause|Break or right click on Computer and choose Properties.
    2. Click Advanced system settings on the left.
    3. Click Environment Variables under the Advanced tab.
    4. Select the PATH variable and click Edit.
    5. Copy the path mentioned above to the value field and press OK.

Running the CMD as Administrator on Windows got me going and I think it only makes perfect sense because people don't really ever make an effort to install their stuff in a custom directory. So when you install node.js in Windows directory and then try to install PhoneGap on a Unelevated CMD it has a hard time setting the path variables.


Phonegap can be a little tricky for freshers. I spent much time trying to find the optimum way for creating a robust android application which can access the phone's native features.

This link provides a step wise method for creating a Phonegap android application using windows, html and javascript.


Examples related to windows

"Permission Denied" trying to run Python on Windows 10 A fatal error occurred while creating a TLS client credential. The internal error state is 10013 How to install OpenJDK 11 on Windows? I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? git clone: Authentication failed for <URL> How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" XCOPY: Overwrite all without prompt in BATCH Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory how to open Jupyter notebook in chrome on windows Tensorflow import error: No module named 'tensorflow'

Examples related to cordova

Why am I seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors after upgrading to Cordova Android 8? Xcode couldn't find any provisioning profiles matching Cordova app not displaying correctly on iPhone X (Simulator) JAVA_HOME is set to an invalid directory: ionic 2 - Error Could not find an installed version of Gradle either in Android Studio cordova Android requirements failed: "Could not find an installed version of Gradle" Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK - Android Ionic 2: Cordova is not available. Make sure to include cordova.js or run in a device/simulator (running in emulator) Cordova : Requirements check failed for JDK 1.8 or greater Can't accept license agreement Android SDK Platform 24