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
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 Platform | What You Need |
|---|---|
| Android |
|
| iOS |
|
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:
| Variable | Points To |
|---|---|
ANDROID_HOME | The 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_HOME | The 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.