Installation

The Cordova command-line tool (CLI) is distributed as an npm package.

To install the cordova CLI tool, follow these steps:

  1. Download and install Node.js. On installation you should be able to invoke node and npm on your line.

  2. (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.

  3. Install the cordova module using npm utility of Node.js. The cordova module will automatically be downloaded by the npm utility.

    • on macOS and Linux:

       npm install -g cordova
      

      For macOS and Linux users, you might need to use the sudo prefix when running the npm 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 the sudo prefix.

      It is also worth noting that it is generally recommended to avoid using sudo with npm 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 tells npm to install cordova globally. Otherwise it will be installed in the node_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