How to Upgrade Cordova 3.5.0-0.2.4 to any higher version?

496 views Asked by At

There are many questions in stackoverflow and in other blogs which says just execute the below command to upgrade-

sudo npm install -g [email protected]

After executing the above command in my terminal i get the following-

 /usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova
[email protected] /usr/lib/node_modules/cordova
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

After that if i execute-

cordova -g -v

i get 3.5.0-0.2.4 as the version. Couldn't find any solution to upgrade from 3.5.0-0.2.4 to higher version , any help would be great. Thank you in advance.

2

There are 2 answers

0
laughingpine On BEST ANSWER

My guess is that sudo is hosing you up here. Running sudo cordova -v should spit out that version you installed. I try to avoid using sudo to install npm modules.

This answer here has a lot of solid solutions in it: npm throws error without sudo

There are some other solutions not included in that thread as well. I tried to find this answer yesterday to link you to as well, but was unable too: NPM modules won't install globally without sudo.

I also had this happen when I first installed node, and based on that answer this was the quickest solution: sudo chown -R $USER /usr/local. That being said there is a concern about playing with permissions like that.

While I haven't tried this myself, apparently installing node from this repository also resolves the error. After removing node, run:

curl -sL https://deb.nodesource.com/setup | sudo bash - 
sudo apt-get install -y nodejs
0
Alexandre Baptiste On

You can use sudo npm update -g cordova or if you want a specific version for exemple sudo npm install -g [email protected].

Check with cordova -v and then if you want to update your platform, here Android, cordova platform update android