Installation & Setup

Before you can create a single Cordova project, you need three things in place: Node.js and npm (because the Cordova CLI itself is distributed as an npm package), the Cordova command-line interface installed globally, and, depending on which platforms you plan to target, the native platform SDKs for Android and/or iOS. This page walks through each piece carefully, including the platform requirements that trip up most beginners.

1. Install Node.js and npm

Cordova's command-line tool is written in JavaScript and published to the npm registry, so Node.js (which bundles npm, the Node Package Manager) is a hard prerequisite — you cannot install or run the Cordova CLI without it. Download the LTS (Long Term Support) release from nodejs.org for your operating system and run the installer. Once installed, confirm both tools are on your PATH:

node --version
npm --version

You should see version numbers printed for both commands (for example v18.17.0 and 9.6.7). If either command is "not recognized" or "not found," Node.js either didn't install correctly or your terminal needs to be restarted so it picks up the updated PATH.

2. Install the Cordova CLI Globally

With Node and npm ready, install the Cordova CLI as a global npm package using the -g flag. Installing it globally (rather than as a local project dependency) makes the cordova command available from any folder in your terminal, which is what you want for a command-line tool you'll use across many projects.

npm install -g cordova
Note: On macOS or Linux you may need to prefix this with sudo if you get a permissions error, since global npm packages are written to a system-level folder by default. On Windows this is rarely an issue.

3. Verify the Installation

Once the install finishes, confirm the CLI is correctly on your PATH and check which version you have:

cordova --version

This should print a version number such as 12.0.0. If you get a "command not found" error, close and reopen your terminal (global npm binaries sometimes require a fresh shell session to be picked up), or double check that npm's global bin directory is included in your system's PATH environment variable.

4. Platform-Specific Requirements

The Cordova CLI itself is cross-platform, but actually building an app for a given target (Android or iOS) requires that platform's native SDK and toolchain to be installed separately. This is the step most beginners underestimate.

Target PlatformWhat You Need
Android
  • Java Development Kit (JDK) — Cordova's Android build tooling (Gradle) runs on the JVM
  • Android Studio, which bundles the Android SDK, SDK command-line tools, and platform-tools (includes adb)
  • At least one installed Android SDK Platform version and a configured emulator (AVD), or a physical device with USB debugging enabled
iOS
  • A Mac running macOS — this is non-negotiable, Apple's tooling does not run on Windows or Linux
  • Xcode, installed from the Mac App Store, which includes the iOS SDK and the Simulator
  • Xcode's Command Line Tools (xcode-select --install)
  • A free or paid Apple Developer account (a paid account is required later to install on a physical device or submit to the App Store)
Common gotcha for Windows developers: if you're developing on Windows or Linux, you can build and test the Android target fully, but you cannot build the iOS target at all — there is no workaround, since Apple only allows Xcode (and therefore iOS compilation) on macOS. Many teams solve this by developing on Windows and only using a Mac (or a cloud Mac build service) for the final iOS build.

5. Checking Your Environment with `cordova requirements`

Rather than guessing whether your machine is properly configured, Cordova provides a built-in diagnostic command that checks each dependency for a given platform and reports what's missing:

cordova requirements android

Run this from inside a Cordova project (see the next page for creating one). It will check for the Android SDK, an appropriate SDK build-tools version, the Java JDK, and Gradle, printing a clear checklist like:

Requirements check results for android:
Java JDK: installed 17.0.2
Android SDK: installed true
Android target: installed android-34
Gradle: installed

You can run the same check for iOS (only meaningful on a Mac) with cordova requirements ios, or check every platform currently added to your project at once with plain cordova requirements.

6. Environment Variables for Android Builds

Android builds rely on two environment variables being set correctly on your system so that Cordova's tooling (and the underlying Gradle build) can find your SDK and JDK installations:

VariablePoints To
ANDROID_HOMEThe root folder of your Android SDK installation (e.g. C:\Users\you\AppData\Local\Android\Sdk on Windows, or ~/Library/Android/sdk on macOS)
JAVA_HOMEThe root folder of your installed JDK (e.g. C:\Program Files\Java\jdk-17)

You should also add the SDK's platform-tools folder (which contains adb) to your system PATH. If cordova requirements android reports the SDK or JDK as missing even though you know they're installed, an incorrectly set (or missing) ANDROID_HOME or JAVA_HOME is almost always the cause — double-check the path is exact and restart your terminal after changing either variable.

Next: With Node, the Cordova CLI, and your platform SDKs in place, head to Your First App to create and run your very first Cordova project.