- Overview
- Installation
- Creating an App
- Project Structure
- 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
nodeandnpmon 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
gitcommand 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
cordovamodule usingnpmutility of Node.js. Thecordovamodule will automatically be downloaded by thenpmutility.-
on macOS and Linux:
npm install -g cordovaFor macOS and Linux users, you might need to use the
sudoprefix when running thenpmcommand 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 thesudoprefix.It is also worth noting that it is generally recommended to avoid using
sudowithnpmto 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
sudowhen installing packages. -
on Windows:
C:\>npm install -g cordova
The
-gflag above tellsnpmto installcordovaglobally. Otherwise it will be installed in thenode_modulessubdirectory of the current working directory.Following installation, you should be able to run
cordovaon 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 |