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.
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: