- Overview
- Installation
- Creating an App
- CLI Commands
- Platform Support
- Platform Pinning
- Version Management
- Hooks
- Android
- iOS
- Electron
- Icons
- Splash Screen
- Security
- Privacy
- Allow List
- Data Storage
- Create a Plugin
- Android
- iOS
- Use Plugman
- Config.xml API
- Plugin.xml API
- Cordova JavaScript API
- Third-party Tools
- App Templates
- Next Steps
- Battery Status
- Camera
- Device
- Dialogs
- File
- Geolocation
- Inappbrowser
- Media
- Media Capture
- Network Information
- Screen Orientation
- Browser Splashscreen
- Statusbar
- Vibration
- Embed Cordova in native apps
Installation
The Cordova command-line tool (CLI) is distributed as an npm package.
To install the cordova
CLI tool, follow these steps:
-
Download and install Node.js. On installation you should be able to invoke
node
andnpm
on your line. -
(Optional) Download and install a git client, if you don't already have one. Following installation, you should be able to invoke the
git
command in your command promt (terminal). The Cordova cli and npm invokes the git command when download assets that were referenced with a git repo url. -
Install the
cordova
module usingnpm
utility of Node.js. Thecordova
module will automatically be downloaded by thenpm
utility.-
on macOS and Linux:
npm install -g cordova
For macOS and Linux users, you might need to use the
sudo
prefix when running thenpm
command to install this utility in restricted directories like/usr/local/share
. However, if you are using the optional nvm/nave tool or have write access to the installation directory, you may be able to omit thesudo
prefix.It is also worth noting that it is generally recommended to avoid using
sudo
withnpm
to prevent potential issues with permissions and package installations.Instead, it's recommended to use a version manager like nvm (Node Version Manager) or nave to manage Node.js and npm installations, which typically avoids the need for
sudo
when installing packages. -
on Windows:
C:\>npm install -g cordova
The
-g
flag above tellsnpm
to installcordova
globally. Otherwise it will be installed in thenode_modules
subdirectory of the current working directory.Following installation, you should be able to run
cordova
on the command line with no arguments and it should print help text. -
Requirements and Support
Cordova CLI Version | Node.js Supported Version |
---|---|
12.x | >=16.13.0 |
11.x | >=12.0.0 |
10.x | >=10.0.0 |
9.x | >=6.0.0 |