Can't update Cordova and Ionic


I can’t update cordova to 5.1.1 and Ionic to 1.6.4. When running

npm update -g cordova

nothing happens.

When running:

npm install -g cordova

i get:

npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.12.7","npm":"2.7.3"})
npm WARN engine cordova-js@4.0.0: wanted: {"node":"~0.10.x"} (current: {"node":"0.12.7","npm":"2.7.3"})
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.7.3"})
npm WARN installMany normalize-package-data was bundled with npm@1.3.4, but bundled package wasn't found in unpacked tree
/usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova
cordova@5.1.1 /usr/lib/node_modules/cordova
├── underscore@1.7.0
├── q@1.0.1
├── nopt@3.0.1 (abbrev@1.0.7)
└── cordova-lib@5.1.1 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, mime@1.2.11, unorm@1.3.3, semver@2.1.0, shelljs@0.3.0, dep-graph@1.1.0, rc@0.5.2, npmconf@0.1.16, through2@0.6.3, xcode@0.6.7, elementtree@0.1.6, d8@0.4.4, request@2.47.0, tar@1.0.2, glob@4.0.6, cordova-registry-mapper@1.1.9, init-package-json@1.7.1, plist@1.1.0, cordova-app-hello-world@3.9.0, npm@1.3.4, cordova-js@4.0.0)

Also Ionic reminds me to update:

Ionic CLI is out of date:
 * Locally installed version: 1.3.14
 * Latest version: 1.6.4
 * Run npm install -g ionic to update

But i can’t do it.

After installing Cordova and Ionic i still have

cordova -v


ionic -v

How can i update?

I’m running Ubuntu 15.04.


This is the correct procedure so something is wrong in your environment.
You should check your PATH, maybe you’re getting cordova and ionic commands from another location than the global node_modules.


I’ve found something interesting: there are free node_modules directories in my computer. In cordova/ I’ve found three different cordova versions

  1. in home/node_modules there is cordova 5.1.1
  2. in usr/lib/node_modules there is cordova 5.2.0
  3. in usr/local/lib/node modules there is cordov 4.3.0

Why there are three node_modules directories and how can I use the newest cordova?


You should have only 2 places: a global one (npm install -g puts stuff there) which can be /usr/lib or /usr/local/lib depending on how you installed nodejs and a local one per project directory (npm install puts stuff there).

You should have only one global, so I recommend you uninstall node and remove both before re-installling. Also these places require you to install node using sudo, I know this is what is written in ionic docs but that’s usually not required, it’s much better to use nvm.

Then /home/node_modules is probably wrong unless you got the wrong idea to start a project in your home.


I’ve removed all these folders and then reinstalled Cordova and Ionic. It work. Thank You.