How To Install Cordova From Source (with npm)

16 Feb

Cordova is frequently taking bug fixes, and it takes a while for these to make it to the official release you get during a simple npm install.

Most relevant for me recently, is the fact that Cordova 4.2.0 (and before) contain a bug affecting Windows targets.  Without this bug fix it is impossible to target a specific architecture for an assembly, which is required for targeting desktop vs. phone.

https://issues.apache.org/jira/browse/CB-8123

Luckily this issue (and others) have been resolved and committed to the git repository.  You just need to install Cordova from the repo directly.  Luckily that isn’t very hard to do properly, and easy to upgrade later when it is officially released.

Open up an administrative command prompt (required for the global npm install) and clone the two repos, and npm install them:

>git clone https://git-wip-us.apache.org/repos/asf/cordova-cli.git
>git clone git://git-wip-us.apache.org/repos/asf/cordova-lib.git
>cd cordova-lib/cordova-lib
>npm install -g && npm link
>cd ../../cordova-cli
>npm link cordova-lib && npm install -g

Thats all – You can verify the version you have (currently 4.2.1-dev) like this:

>cordova -v
Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *