How to Install Apache Cordova CLI using npm in windows.

In this tutorial, let us see that how to install Cordova CLI  (Command Line Interface) in windows

To install Cordova CLI, follow the below steps.

1) Get npm utility

2. Download git client

3. Install cordova using npm.

Cordova can be installed through npm. As npm manages dependencies for an application, it is better to use npm to install Cordova CLI.

To get npm, download Node.js source code at https://nodejs.org/download/ and install. Once installation is completed, Please ensure that the path C:\Users\UserName\AppData\Roaming\npm is included in Windows Path.

Usage : npm install moduleName

Download git client http://git-scm.com/ and install. For windows, download at http://git-scm.com/download/win. CLI uses git indirectly, for downloading necessary assets when creating a new project.

git setup windows git setup windows1

To install cordova using npm

npm install cordova

To install globally, use the option g

npm install -g cordova

In Windows environment, give the command
f:\>npm install -g cordova

The above command downloads and installs cordova and the output

npm WARN engine cordova-js@3.9.0: wanted: {"node":"~0.10.x"} (current: {"node":"0.12.4","npm":"2.10.1"})
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.12.4","npm":"2.10.1"})
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.4","npm":"2.10.1"})
npm WARN installMany normalize-package-data was bundled with npm@1.3.4, but bundled package wasn't found in unpacked tree
C:\Users\UserName\AppData\Roaming\npm\cordova -> C:\Users\UserName\AppData\Roaming\npm\node_modules\cordova\bin\cordova
cordova@5.0.0 C:\Users\UserName\AppData\Roaming\npm\node_modules\cordova
├── underscore@1.7.0
├── q@1.0.1
├── nopt@3.0.1 (abbrev@1.0.7)
└── cordova-lib@5.0.0 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, mime@1.2.11, unorm@1.3.3, semver@2.1.0, shelljs@0.3.0, dep-graph
1.1.0, rc@0.5.2, npmconf@0.1.16, d8@0.4.4, through2@0.6.3, xcode@0.6.7, glob@4.0.6, elementtree@0.1.5, cordova-registry-mapper@1.1.5, init-package-json@1.6.0, tar@1.0.2,
equest@2.47.0, cordova-app-hello-world@3.9.0, plist@1.1.0, cordova-js@3.9.0, npm@1.3.4)  

Now Cordova installation is complete and the installed directory is

C:\Users\UserName\AppData\Roaming\npm\cordova

Now We need to include the SDK’s tools and platform-tools directories in Windows PATH sothat Cordova CLI commands will run on any path. If you develop  app for android platform, then  include android SDK tools and android platform tools directories in windows PATH.

For example,

F:\Software\Android\android-sdk\tools and F:\Software\Android\android-sdk\platform-tools

where F:\Software\Android\android-sdk\ where android sdk is installed.

To change path (variable) in windows (8), right click on My Computer -> properties -> Advanced system settings -> Advanced tab –> Environment variables -> Edit Path variable to include   below path

    ;F:\Software\Android\android-sdk\tools;F:\Software\Android\android-sdk\platform-tools

then ok.cordova CLI path set

 

To check cordova CLI installation, just open command prompt and type cordova and enter in any path.

f:\cordova> cordova

 

cordova cli test

For building demo app in Cordova, Please visit  Apache Cordova Hello World

Reference :  Cordova CLI

You may also like

Leave a Reply

Be the First to Comment!