There are a few basic requirements you'll need prior to installing the PhoneGap CLI:
- git - used in the background by the CLI to download assets. It comes pre-installed on some operating systems. You can check if it's already installed by typing
gitfrom the command line.
Install via npm
Run the following command to install the latest version of the PhoneGap CLI:
$ npm install -g phonegap
Installing a Specific Version
You can install a specific version of the PhoneGap CLI via
npm by specifying the version number after the
$ npm install -g email@example.com
$ npm info phonegap
EACCESerror when running any of the commands here, try prefixing it with
sudo, such as:
$ sudo npm install -g phonegap
PhoneGap CLI Use Cases
The PhoneGap CLI can be used for different stages of development and with other tools offered by the PhoneGap team. The multiples use cases are outlined below and will determine any other dependencies that may need to be installed.
1 - Paired with the PhoneGap Developer App
2 - Paired with PhoneGap Build
Use the PhoneGap CLI to create and configure your apps locally, then build and package them in the PhoneGap Build cloud service.
remotecommand is used from the PhoneGap CLI to interface with PhoneGap Build once your project has been configured. The Remote Usage Guide provides the details for this command. For details on how to specifically configure your apps for PhoneGap Build. Check out their docs located here.
3 - Standalone
The PhoneGap CLI can be used to do everything from creating your apps to packaging them for distribution. To build, run and package apps for multiple platforms you'll need to install some additional SDK's and/or tools for the platforms you wish to target. Refer to the Cordova Platform Guides for details on how to proceed for each platform.