Ionic error of Cordova lower version - Please install your Cordova CLI to version >=4.2.0
Asked Answered
R

9

28

Installed Ionic successfully. When running ionic info and other commands like ionic browser --list, I get an error that cordova is lower then version 4.

Cordova is installed with no sudo and in global home directory.

> ionic info

Your system information:

Cordova CLI: 6.1.0 (cordova-lib@undefined)
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Distributor ID:     Ubuntu Description:     Ubuntu 15.10 
Node Version: v5.9.1


******************************************************
 Dependency warning - for the CLI to run correctly,      
 it is highly suggested to install/upgrade the following:     

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`

******************************************************

Cordova installation is at:

> which cordova
  /home/user_1/.npm-global/bin/cordova

Ionic installation is at:

> which ionic
/home/user_1/.npm-global/bin/ionic
Reminiscence answered 29/3, 2016 at 12:57 Comment(0)
G
32

I've tried a lot of different methods to resolve this, like reinstall with and without the --unsafe-perm=true --allow-root flags (which is how others advised to fix it on other questions/other places online) but it seems to be an issue with cordova at version 6.1.0 and ionic so for now use 6.0.0 by running

npm install -g [email protected]

That should do the trick as it is seems 6.1.0 isn't a stable version.

Godly answered 29/3, 2016 at 22:59 Comment(2)
Thanks. I also had Cordova installed as root so I'v uninstalled it from root and installed on local with -g. Still only the 6.0.0 worked.Reminiscence
This worked for me, There is also another way which was worked for me is "npm install -g cordova@latest"Alverta
V
53

I am using [email protected] and [email protected] as well. After I got this error message, I opened a new terminal and typed cordova -v which outputted:

? May Cordova anonymously report usage statistics to improve the tool over time?

As soon as I entered my answer (No), the version number printed out and then I re-ran ionic info in my project terminal. The error was gone.

Caveats

  • I had just updated [email protected] from 1.7.15. It's a very minor patch with one set of bug fixes that are not related to this.
  • The particular system that I had this problem with is running Windows 10.
  • The first time I ran ionic info in my project directory, I got the same error twice.

Original Error Output:

******************************************************
 Dependency warning - for the CLI to run correctly,
 it is highly recommended to install/upgrade the following:

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`

******************************************************

Your system information:

You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.2.0

Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS:
Node Version: v4.4.2


******************************************************
 Dependency warning - for the CLI to run correctly,
 it is highly recommended to install/upgrade the following:

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`

******************************************************
Vanhook answered 14/7, 2016 at 15:20 Comment(4)
That has been the answer for me!Willy
Yep, for me too. It seems likely that ionic at some point issues cordova -v, then doesn't understand the output and hence falls back to assuming that the version is not as expected.Wheatear
I'm using [email protected] & [email protected] - this solution fixed my issue as well.Admission
Thaaaank you. So many issues seem to be the result of these prompts... cough BOWER cough coughDrucill
G
32

I've tried a lot of different methods to resolve this, like reinstall with and without the --unsafe-perm=true --allow-root flags (which is how others advised to fix it on other questions/other places online) but it seems to be an issue with cordova at version 6.1.0 and ionic so for now use 6.0.0 by running

npm install -g [email protected]

That should do the trick as it is seems 6.1.0 isn't a stable version.

Godly answered 29/3, 2016 at 22:59 Comment(2)
Thanks. I also had Cordova installed as root so I'v uninstalled it from root and installed on local with -g. Still only the 6.0.0 worked.Reminiscence
This worked for me, There is also another way which was worked for me is "npm install -g cordova@latest"Alverta
M
15
cordova telemetry off

Made the error disappear when running

ionic info

I chose to opt out of Telemetry which collects data during development for analytics. You can also opt in by using the "on" keyword instead.

Hat tip to Wayne Bloss for guiding me to this answer.

Mohammadmohammed answered 25/10, 2016 at 15:18 Comment(1)
This worked for me, and when I turned telemetry back on it kept! working.Epagoge
D
9

I had exactly the same result as Wayne Bloss on Windows 10. The error "> = 4.2.0" on the first attempt, and after checking the version "cordova -v", the error was gone (I answered Yes to the question on statistics).

Discordancy answered 24/7, 2016 at 20:14 Comment(1)
Works, don't know...don't care :PSubacute
A
4

As stated by Wayne Bloss this warning disappears when answering the question triggered by the command cordova -v. This worked also for my configuration using Cordova 6.3.1.

This works because the original reason for this is that the version information string for Cordova CLI not only contains the version number but also this piece of information "You have been opted out of telemetry. To change this, run: cordova telemetry on." which makes the internal evaluation of the string with semver return always false. Answering the telemetry question with "no" removed the string from the version thus making the warning message disappear.

Ashby answered 16/8, 2016 at 10:29 Comment(0)
T
3

I just ran into this so I found this page and seems like no proper answer so here is one.

Installing the cordova-cli deb package requires to:

  • Add the Ubuntu Cordova Personal Package Archive to your Ubuntu system
  • Install the cordova-cli package (and its dependencies)

So, for ubuntu

sudo apt-add-repository ppa:cordova-ubuntu/ppa
sudo apt-get update
sudo apt-get install cordova-cli

More info here https://cordova.apache.org/docs/en/latest/guide/platforms/ubuntu/index.html

Tomekatomes answered 4/11, 2016 at 13:54 Comment(0)
E
1

As others have noted, a possible cause of this is noise from cordova telemetry.

The issue is still present in cordova 6.5.0 and ionic 2.2.2.

As an additional piece of information, I would like to add that the following has to be run for the current user, e.g. if you have a CI system that installs cordova as root and then runs ionic as a non-privileged user, you will have to run

cordova telemetry off

again.

Esthonia answered 11/4, 2017 at 11:49 Comment(0)
A
0
D:\>ionic start myapp blank
******************************************************
 Dependency warning - for the CLI to run correctly,
 it is highly recommended to install/upgrade the following:

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`

******************************************************
Creating an Ionic app in D:\myapp based on the blank template.

Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
Downloading: https://github.com/driftyco/ionic-starter-      blank/archive/master.zip
Installing npm packages (may take a minute or two)...
/
? ♫ ? ♫  Your Ionic app is ready to go! ? ♫ ? ♫

The Ionic application is started without any issue of Cordova updating. You can however, use the following code to update:

npm update -g cordova
Alvaalvan answered 25/1, 2017 at 14:6 Comment(0)
L
0

It's well written in the caveat, You need to install cordova in your npm using npm install -g cordova or

npm install -g [email protected]

Problem solved!

Lichter answered 5/9, 2019 at 5:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.