Global packages for cordova (Cordova CLI) not same with my other project

Hello guys,
i really need your help. i don’t know what really happen and how to solve it. i try reinstall npm, node, ionic and cordova but the version is still not change. i try already delete node_modules and package-lock.json, then npm i but still not change cordova version. i want to change it cordova 7.1.0. when i run cordova -v it show 7.1.0 but i run in my current project ionic info it show

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0 browser 5.0.3 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.9.4
    npm  : 5.6.0
    OS   : macOS High Sierra

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

But when i run ionic info in other project it show

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.5
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.9.4
    npm  : 2.15.12
    OS   : macOS High Sierra

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

I was going to post the very same question as I have two projects both showing different “global” Cordova CLI versions. Would be interested to know how this works.

Run which cordova in both project folders and outside.
Run npm list -g --depth=0 and npm list --depth=0 in both project folders.

Anything interesting popping up?

@Sujan12 thanks - I have never used those commands before.

which cordova gives the same result in both projects:

/usr/local/bin/cordova

npm list -g --depth=0 also gives the same in both:

/usr/local/lib
├── cordova@7.0.1
├── ionic@3.18.0
├── ios-deploy@1.9.2
├── npm@5.5.1
├── remotedebug-ios-webkit-adapter@0.2.2
└── source-map-explorer@1.5.0

npm list --depth=0 results in a whole load of output (similar in both) but what looks like errors e.g

npm ERR! missing: isexe@2.0.0, required by which@1.3.0
npm ERR! missing: errno@0.1.4, required by worker-farm@1.5.1

Does this give any clues as to why ionic info gives different Cordova CLI versions?

No, not really.

I would just use my nvm install to install a new node and install cordova and ionic there again and be done with it instead of investigating.

I found out how to solve this problem. That command just realise what the problem. Before i solve found out in node_modules > cordova > package.json . My cordova version was 8.0.0 . So i try to delete the file cordova manual and take other project cordova (which is version 7.1.0) file put it in current project that have problem with cordova version. But this method does work because even it said the version is same with your cordova -v but still use my current project that have problem which use other cordova lib ( which is 8.0.0).

below is method work on me :

remove cordova without -g ( global)
sudo npm uninstall cordova
install cordova that same with your cordova -v at cordova@[version]
sudo npm install cordova@7.1.0

U will found it not remove your cordova in node_module but when u install cordova back it change the verison.

Reminder: dont make it global. Just run command on your project that has problem.