Visual Studio Tools for Apache Cordova (VSCordovaTools for short) is a great Visual Studio toolset to develop hybrid applications for multiple platforms, including Android, iOS and Windows. One of the nice things about the tool is that it installs everything you need to develop with Cordova. You don’t have to care about installing multiple components, runtimes, setting system environment variables, etc. However, one of the drawbacks is that it is not currently supporting updating those components to newer versions.
The latest release available for VS 2013 is CTP 3.1 and this build comes with Cordova 3.5.0. Should you need to use a newer version you have to do it manually. In this blog post I will list all the steps you need to do to update to the latest version Cordova (currently 5.1.1) both on Windows and on Mac (where you build the iOS version of the hybrid apps). However, in these steps I will also include how to update Node.js and npm.
Update Cordova on Windows
Note: Make sure you close all instances of Visual Studio before starting this process.
- Download and install the latest version of Node.js from nodejs.org.
- Update npm. To check your current npm version run the following command in a console:
To update to the last version of npm run the following command in a console (elevated As Administrator):
Shell1npm install -g npm
- Update Cordova. To check your Cordova version run the following command in a console:
To update to the last version of cordova run the following command in a console (elevated As Administrator):
Shell1npm install -g cordova
- Update the vs-mda version of Cordova with the latest you just installed in the previous step. Cordova is (globally) installed at %APPDATA%\npm\node_modules\cordova. vs-mda copy of Cordova is available at %APPDATA%\npm\node_modules\vs-mda\node_modules\cordova. Replace the entire content of this folder with the one of the global Cordova installation.
- Install missing modules (this might depend on the latest version you install). For 5.1.1 I had to install concat-map and balanced-match. If anything else is necessary it should show up in the output log when you build your Cordova project.
Shell1npm install -g concat-map
Shell1npm install -g balanced-match
Update Cordova on Mac
Note: Make sure you stop the vs-mda-remote agent before performing this upgrade.
- Open a Terminal session and run the following command:
Shell1sudo npm update -g cordova
- Update the vs-mda-remote version of Cordova with the the latest you just installed in the previous step. Cordova is (globally) installed at /usr/local/lib/node_modules/cordova. vs-mda-remove copy of Cordova is available at /usr/local/lib/node_modules/vs-mda-remote/node_modules/cordova. Replace the entire content of this folder with the one of the global Cordova installation.
- Restart the vs-mda-remote agent.
With all these installed you should be all set to start building with the latest version of Cordova.