Installing Cordova CLI and Ionic

2019-04-07 13:57发布

问题:

Recently I installed node.js together with ionic and cordova with:

sudo npm install -g cordova ionic

... and everything seems to work fine. But when I run:

ionic info

It seems that Cordova CLI is missing:

Your system information:

Cordova CLI: Not installed
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic Version: 1.1.1
Ionic CLI Version: 1.7.10
Ionic App Lib Version: 0.6.5
ios-deploy version: 1.8.2 
ios-sim version: 5.0.3 
OS: Mac OS X El Capitan
Node Version: v5.1.0
Xcode version: Xcode 7.1.1 Build version 7B1005 


******************************************************
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`

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

I then tried to upgrade cordova as suggested. I also tried to uninstall cordova and reinstall it, clearing the npm cache before reinstallment but after running

ionic info

...again I still get:

Cordova CLI: Not installed

Does somebody know the correct procedure to install Cordova CLI?

回答1:

In the end the answer was simple: update cordova to a specific package. I ended up using:

npm install -g cordova@4

... which solved the problem.



回答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


Your system information:

Cordova CLI: Not installed
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.5.0
Xcode version: Not installed


回答3:

The same problem seems to have reappeared with version 4.2.0.

Running

$ cordova telemetry off

solved the problem for me. (cordova telemetry on seems to work too)

Details:

$ ionic info
******************************************************
 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.5.0

Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.9.5
Xcode version: Not installed


******************************************************
 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`

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


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


$ ionic info

Your system information:

 ordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.9.5
Xcode version: Not installed