<html><head><link rel="canonical" href="https://www.jetbrains.com/help/idea/using-phonegap-cordova.html.md/" data-react-helmet="true"/></head><body># PhoneGap and Cordova

&gt; **TL;DR**
&gt; Required plugins:
&gt;
&gt;
&gt;
&gt; `JavaScript and TypeScript`&nbsp;-&nbsp;   the plugin is bundled with IntelliJ&nbsp;IDEA and enabled by default.
&gt;
&gt;
&gt;
&gt; `Cordova`&nbsp;-&nbsp;   install the plugin on the Settings | Plugins page, tab Marketplace.     The plugin is available only in IntelliJ&nbsp;IDEA with the Ultimate subscription.

[PhoneGap](http://phonegap.com/) and [Apache Cordova](http://cordova.apache.org/) are frameworks for developing mobile application with single HTML, CSS, and JavaScript/TypeScript code base and targeting various mobile platforms, including [Android](http://cordova.apache.org/).

## Before you start

Procedure:

1. Make sure you have [Node.js](http://nodejs.org/)  on your computer.

2. Make sure the  JavaScript and TypeScript plugin is enabled in the settings.  Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))  to open settings and then select `Plugins`.  Click the Installed tab. In the search field, type JavaScript and TypeScript. For more information about plugins, refer to [Managing plugins](managing-plugins.html).

3. Install and enable the Cordova plugin on the Settings | Plugins page, tab Marketplace, as described in [Installing plugins from
JetBrains Marketplace](managing-plugins.html#install_plugin_from_repo).     The plugin is available only in IntelliJ&nbsp;IDEA with the Ultimate subscription.

4. Download and install an emulator tool depending on the target platform and the operating system you use. Learn more from the [Cordova](https://cordova.apache.org/docs/en/latest/#develop-for-platforms) official website.

5. To emulate the [iOS](https://developer.apple.com/ios/) platform,  install the [ios-sim](https://github.com/ios-control/ios-sim) and  [ios-deploy](https://github.com/ios-control/ios-deploy) command-line tools globally.

Open your command-line shell or  the embedded Terminal (`Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Alt+F12` (NetBeans), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS)))   and type:

`npm install -g ios-sim`

`npm install -g ios-deploy`

## Installing PhoneGap and Cordova

Procedure:

In your command-line shell or in the embedded Terminal (`Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Alt+F12` (NetBeans), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS))) , type one of the following commands:

* `npm install -g phonegap@latest`

Learn more from the [PhoneGap official
website](http://docs.phonegap.com/getting-started/1-install-phonegap/cli/).

* `npm install -g cordova`

Learn more from the [Cordova official website](https://cordova.apache.org/#getstarted).

## Creating a new PhoneGap or Cordova application

If you have no application yet, you can generate an IntelliJ&nbsp;IDEA project with PhoneGap or Cordova-specific structure from a boilerplate template. Alternatively, create an empty IntelliJ&nbsp;IDEA project and configure PhoneGap or Cordova support in it.

Procedure: Create an application from a template

1. Select `File | New | Project` from the main menu or click the New Project button on the Welcome screen.

2. In the New Project dialog, select JavaScript in the left-hand pane.

3. In the right-hand pane, choose Cordova and click Next.

4. On the second page of the wizard, specify the project name and the folder to create it in.   Specify the location of the executable file. Depending on your operating system and target platform, this can be `phonegap`, `phonegap.cmd`, `cordova`, or `cordova.cmd`.

5. When you click Finish, IntelliJ&nbsp;IDEA generates a skeleton of an application with the framework-specific structure.

## Starting with an existing PhoneGap or Cordova application

To continue developing an existing application, open it in IntelliJ&nbsp;IDEA, download the required dependencies, and configure PhoneGap or Cordova support in your project.

Procedure: Configure PhoneGap or Cordova in your project

1. Open the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))) and go to `Languages &amp; Frameworks | JavaScript | Cordova`.

2. Check the location of the executable file or specify the path to it if IntelliJ&nbsp;IDEA has not detected the executable automatically. This can be `phonegap`, `phonegap.cmd`, `cordova`, or `cordova.cmd`, depending on your operating system and the selected framework.

IntelliJ&nbsp;IDEA detects the installed version and displays it in the Cordova version read-only field.

3. In the Cordova working directory field,  specify the folder where the application files to run are stored.

4. By default, IntelliJ&nbsp;IDEA automatically treats the `platforms` or `www` directory as excluded and ignores it during project analysis, parsing, and code completion, refer to [Configuring
folders in a content root](null).

To preserve this default behavior, make sure the Automatically exclude working directories ('platforms', 'www' for ionic) checkbox is selected.

### Project security

When you open a project that was created outside IntelliJ&nbsp;IDEA and was imported into it, IntelliJ&nbsp;IDEA displays a dialog where you can decide how to handle this project with unfamiliar source code.

Select one of the following options:

* Preview in Safe Mode: in this case, IntelliJ&nbsp;IDEA opens the project in a preview mode. It means that you can browse the project's sources but you cannot run tasks and script or run/debug your project. IntelliJ&nbsp;IDEA displays a notification on top of the editor area, and you can click the Trust project… link and load your project at any time.

* Trust Project: in this case, IntelliJ&nbsp;IDEA opens and loads a project. That means the project is initialized, project's plugins are resolved, dependencies are added, and all IntelliJ&nbsp;IDEA features are available.

* Don't Open: in this case, IntelliJ&nbsp;IDEA doesn't open the project.

Learn more from [Project security](project-security.html).

&gt; **Tip:**
&gt; Projects created from the Welcome screen or via `File | New | Project` as described in  are automatically considered trusted.

## Running PhoneGap and Cordova applications

PhoneGap and Cordova applications are executed according to a dedicated run/debug configuration.

Procedure: Create a run configuration

1. Go to `Run | Edit Configurations`. In the Edit Configuration dialog that opens, click ![the Add New Configuration button ](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.add.svg) on the toolbar and select Cordova from the context menu.

2. In the [Run/Debug Configuration:
Cordova](run-debug-configuration-phonegap-cordova.html) dialog that opens, specify the following:

1.  The name of the configuration.

2.

In the Cordova executable field,  specify the location of the executable file `phonegap`, `phonegap.cmd`, `cordova` or `cordova.cmd`, depending on your operating system and the selected framework.

3.

In the Cordova working directory field,  specify the folder where the application files to run are stored.

4.

From the Command list,  choose the command to run. The contents of the list, depend on the actually used framework, namely, on the executable file specified in the Cordova executable field. The available options are:

* For PhoneGap: * emulate * run * prepare * serve * remote build * remote run See [PhoneGap CLI](https://www.npmjs.org/package/phonegap) for a list of PhoneGap-specific commands with descriptions.

* For Cordova: * emulate * run * prepare * serve See [Cordova CLI](https://www.npmjs.org/package/cordova) for a list of Cordova-specific commands with descriptions.

5.

From the Platform list, choose the platform for which the application is intended.

The available options are:

* Android

* iOS To emulate this platform, install the [ios-sim](https://github.com/ios-control/ios-sim) and [ios-deploy](https://github.com/ios-control/ios-deploy) command-line tools globally. Open your command-line shell or the embedded Terminal (`Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Alt+F12` (NetBeans), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS))) and type: `npm install -g ios-sim` `npm install -g ios-deploy`

* browser

* amazon-fireos

* firefoxos

* blackberry10

* ubuntu

* wp8

* windows

* windows8

Learn more about targeted platforms from the [Platform Guides](http://docs.phonegap.com/en/edge/guide_platforms_index.md.html#Platform%20Guides).

6.

For Cordova, specify the targeted virtual or physical Android device to run the application on: select the Specify Target checkbox and select the required device from the list.

The list shows all the virtual and physical devices that are currently configured on your machine. Learn more about setting up emulators from the [Cordova official website](https://cordova.apache.org/docs/en/8.x/guide/platforms/android/index.html#setting-up-an-emulator).

If IntelliJ&nbsp;IDEA displays the following error message: Cannot detect ios-sim in path, make sure you have installed the `ios-sim`, refer to [Before
you start](#ws_cordova_before_you_start_install_ios-sim).

Procedure: Run an application

* Select the newly created run configuration from the list on the main toolbar and click ![the Run button](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.run.run.svg).

## See also

### Procedures

[Projects](creating-and-managing-projects.html)

### Reference

[Run/Debug Configuration: Cordova](run-debug-configuration-phonegap-cordova.html)

</body></html>