Colin
Colin

Reputation: 22595

What version of Cordova do I have and how should I fix it?

In a command line I type cordova -v and it tells me I have 3.6.3-0.2.13 Also, if I type ionic lib it tells me that my Local Ionic Version is 1.0.0-beta.13 but the latest version is 1.1.0

When I open my "Tools for Apache Cordova" project in Visual Studio 2015 and look at Platforms, the version for the Cordova CLI that will be used to build the project is specified as 4.3.0

When I Debug -> Start without debugging, in the output window I see the following text: ------ Cordova tools 4.3.0 already installed

Yesterday, in Visual Studio 2015 I used Tools -> Extensions and Updates to update Visual Studio Tools for Apache Cordova, but clearly that doesn't upgrade Ionic.

I am having some problems with my environment and would appreciate guidance on how to get it set up properly.

Should I update Ionic via the command line? Will that also update Cordova or should I do that separately? Is that likely to break any other dependencies? Why does Visual Studio say 4.3.0 is installed but the command line says 3.6.3-0.2.13? Or are these two different beasts?

Upvotes: 1

Views: 1940

Answers (2)

Colin
Colin

Reputation: 22595

When you type cordova -v, you get the globally installed version of cordova, which on my machine is described by a package.json file located in C:\Users\Colin\AppData\Roaming\npm\node_modules\cordova

I also have a package.json file in C:\Users\Colin\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\4.3.0\node_modules\cordova - and that is the one VS2015 was using because my taco.json file contains "cordova-cli": "4.3.0".

I re-installed the global ionic CLI and cordova using

npm uninstall –g ionic
npm uninstall –g cordova
npm install –g cordova ionic

Now when I type cordova -v, I'm told my global version is 5.3.3

To make VS2015 also use 5.3.3, I double-clicked on the config.xml and changed the value on the Platforms page from 4.3.0 to 5.3.3, then I ran a build. During the build I got a message Installing Cordova tools [email protected] for project from npm. Now I have a package.json file at C:\Users\Colin\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.3.3\node_modules\cordova

Subsequent builds give a message Cordova tools 5.3.3 already installed

The other thing I found confusing is the difference between the Ionic CLI and the Ionic Library.

When you type ionic -v that tells you the version of the CLI (now 1.7.7 on my machine).

ionic lib tells you the version of the ionic javascript library installed in the www/lib/ionic folder - which on my machine is now 1.1.0 after I ran ionic lib update in my project folder

Reference:

https://stackoverflow.com/a/33262777/150342

Upvotes: 1

André Kreienbring
André Kreienbring

Reputation: 2509

Ionic depends on cordova. (At least for mobile development) They can (and must) be updated separatly.

As cordova has recently changed to the gradle build system updating may cause issues. Especially regarding installed plugins.

If you updated cordova with npm update -g cordova --save then you should also update the platforms in your project folder with cordova platform update <your_platform>

Ionic CLI is updated by typing npm update -g ionic --save after that you can update the ionic libs in your project folder with ionic lib update

I can't say anything regarding your Visual Studio problem as I don't use it. But maybe VS comes with an included version of cordova?

Upvotes: 2

Related Questions