0

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

sudo npm install -g cordova@5.1.1

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

 /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, semver@2.1.0, unorm@1.3.3, shelljs@0.3.0, dep-graph@1.1.0, xcode@0.6.7, rc@0.5.2, cordova-app-hello-world@3.9.0, npm@1.3.4, elementtree@0.1.6, d8@0.4.4, npmconf@0.1.16, through2@0.6.3, glob@4.0.6, request@2.47.0, cordova-registry-mapper@1.1.8, plist@1.1.0, init-package-json@1.6.0, tar@1.0.2, cordova-js@4.0.0)

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.

SkyTreasure
  • 854
  • 2
  • 13
  • 23
  • 1
    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. If you have issues, check out http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo – laughingpine Jun 16 '15 at 19:27
  • Wohooo! Thanks mate your link helped , specifically this one. - http://stackoverflow.com/a/24404451/1084806 – SkyTreasure Jun 18 '15 at 00:47

2 Answers2

1

You can use sudo npm update -g cordova or if you want a specific version for exemple sudo npm install -g cordova@3.1.0-0.2.0.

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

1

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
Community
  • 1
  • 1
laughingpine
  • 1,039
  • 14
  • 20