how to build multiple cordova applications with different cordova version

instead of installing the cordova client with

 npm install -g cordova   # DON'T USE THIS

You should just install the cordova client locally, the best way is to put the cordova dependency in the file package.json so when you run the npm install in the root folder of your application, it will install the appropriate cordova version related to this application.

 # if you have a well configured package.json
 #
 npm install

or

 # without a package json
 # if you want the cordova version 5.2.0
 #
 npm install cordova@5.2.0

But it is not enough because your path is not up to date so when you run cordova, it is still pointing to the global one. The trick is to run the following command (or add it to your .bashrc) :

 export PATH=./node_modules/cordova/bin:$PATH

then type again

 cordova -version

That’s it ! You are running cordova with local cordova client defined by the developer of the app.

Build and install nodejs, npm and cordova on Linux (debian)

A quick reminder on how to install nodejs, npm and cordova from scratch…

to complete the installation make sure you have sufficient rights to create flles in /usr/lib and /usr/bin (use sudo or su otherwise)

NodeJS

nodejs is a python based http engine

download nodejs sources

./configure
make
make install
NPM

npm is a packet manager (like pear in PHP world)

get sources then

./configure
make install

The make is made by dummies and does not detect already built files so use « make install » directly to avoid building file twice.

Cordova

install cordova using the npm package manager:

npm install -g cordova