1
votes

I have Cordova installed in my project (version 3.4.0-0.1.3) and I am trying to update it to version 3.5.0-0.2.7 I am running the command

sudo npm update -g [email protected] 

and it works fine. When I run

npm ls -g | grep cordova

I get:

├─┬ [email protected]
│ ├─┬ [email protected] 
│ │ ├─┬ [email protected] 
│ │ ├─┬ [email protected] 
│ ├─┬ [email protected] 

But when I run

cordova -v

I still get the same version I had before 3.4.0-0.1.3

Why can't I update my project? There must be something I'm missing...

I need to update cordova to build my project, please help!

Thanks

1
have you tried install instead of update?Dawson Loudon
Was cordova installed as root to begin with, i.e with sudo? Also, what is the output of npm ls -g? sudo npm ls -g?ctlacko
Yes, I tried install too.Guy Sopher
Anyone knows what might be the problem?Guy Sopher

1 Answers

0
votes

I had same issue on Ubuntu 14.04. when trying to upgrade to Cordova 3.6.3. It seems that npm -g installs modules to

/usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova

But the output of

which cordova

showed this:

/usr/local/bin/cordova

And that symlink was pointing to another nnode_modules installation:

/usr/local/lib/node_modules/cordova/bin/cordova

I'm no Node/npm specialist...so I'm not sure what the correct path is and where the installations in /usr/local/lib/node_modules come from. But since nmp -g installed into /usr/lib/node_modules...I've deleted the /usr/local/bin/cordova symlink and afterwards everything worked fine.

Edited: When I delete /usr/local/bin/cordova I get bash error /usr/local/bin/cordova not exists. To solve it create correct symlink with

sudo ln -s /usr/bin/cordova /usr/local/bin/cordova