Unable to Update IONIC CLI Version

I am getting an error TypeError: env.runcmd is not a function while building ionic 1 application.

 $ionic cordova build android

After researching the issue, i found out that i have to update my ionic CLI to the latest version( which is 3.7.0 ). So, i did the following steps:

$npm install -g npm@latest ( Here npm is v4.5.0 )
$npm uninstall -g ionic
$npm uninstall -g cordova
$npm install -g ionic
$npm install -g cordova

Then, i created a new project and tried to build it, but it still gave the same error and the ionic CLI was not updated and it was still the old version. Here is my ionic info output

global packages:

  @ionic/cli-utils : 1.0.0
  Cordova CLI      : 7.0.0
  Ionic CLI        : 3.0.0

 local packages:

 Cordova Platforms : android 6.2.3
 Ionic Framework   : ionic1 1.3.3

 System:

  Node       : v6.11.2
  OS         : Windows 10
  Xcode      : not installed
  ios-deploy : not installed
  ios-sim    : not installed

Run npm list -g --depth=0 please.

What commands exactly did you use?

@Sujan12
I ran the command and i got an error

$ npm list -g --depth=0
C:\usr\local
+-- @ionic/cli-utils@1.3.0
+-- bower@1.8.0
+-- brew@0.0.8
+-- gulp@3.9.1
+-- gulp-cli@1.3.0
+-- npm@5.3.0
+-- npm-windows-upgrade@4.0.1
+-- sails@0.12.13
 `-- UNMET PEER DEPENDENCY strip-ansi@^3.0.1

npm ERR! peer dep missing: strip-ansi@^3.0.1, required by @ionic/cli-utils@1.3.0

What to do ??
I think when i do npm uninstall -g ionic it doesnt uninstall properly

i mentioned the list of commands to update ionic. Then, i created an ionic1 project and did ionic cordova build android

It is uninstalled right now.

Do you do any strange things with node, npm, ubuntu on WIndows or anything similar?

But, ionic -v still gives me 3.0.0.
Is there a way to completely remove ionic and cordova

Fixed it.
Instead of ionic cordova build android, i just did cordova build android and it worked.

But, still my CLI is not updated :(:frowning_face:

This just packaged the last version of the Ionic app that was built into a Cordova app and didn’t actually build the app. So no changes etc.

Something is broken on your system. When ionic is not in global npm, it should not run. Restart your computer and try again. Also:

Your path looks strange.