How do you check (and update) your PhoneGap version in 3.0?

This post is more than 2 years old.

A tip of the rage wolf to fellow Adobian Brian Leroux for his help with this blog post. And by help, I mean he basically explained it all to me and I'm just making it pretty.

One of the big changes to PhoneGap 3.0 is in how you install it. Previously you would download a zip file, expand it, and have all the bits you need. Now the installation process has you use npm (Node Package Manager) to grab the bits.

I've been using Node and npm for a while, but I'm definitely still a bit unsure of how it works. The question I had was - how would I be able to tell when a new version was released and how would I get my copy updated?

First, remember that the phonegap CLI has a -v argument that tells you the current version you have installed:

Currently the PhoneGap site only mentions 3.0 and not anything more specific, so to compare your version to the latest in npm, you would do "npm info phonegap version". This is demonstrated below:

In this case, my version is the same, but if I wanted to update, I'd run: npm update -g phonegap. I always use sudo in front but you may not have to do that (especially on Windows ;).

Hope this helps. Tomorrow morning I'll be blogging about how plugins have changed.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by abada posted on 9/6/2013 at 11:07 AM

thanks for helpful information.

Comment 2 by Ryan posted on 9/14/2013 at 10:20 AM

Using node.js to install phonegap is confusing, you should go back to a regular
package in a zip file. The npm folder where phonegap gets installed is in the
C:\Users\my\AppData\Roaming or maybe the AppData local folder for some.

The Phonegap build folder for cloud should come as a seperate installation

I had phonegap build phonegap this and that in the npm folder and in the npm cache folder. There was also different android files and folders in all of them.

Kind of reminds me of some Zend folders that I was using that were 14 levels deep just to store one .css file or one flower picture. Personally I would rather find and search through a few folders for multiple files than get lost in a 2000 folders, 20 levels deep MVC Node framework; too me that is the 9th circle of Hell

There is way way too much ambiguity in the folder directory traversal with node.js and phonegap. Here is an example in windows 7

C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules
\cordova\node_modules\npm\node_modules\read-installed\test

The way that everything is stored and personally navigating between all these hundreds of folders makes me as a developer want to put a Gun in my Mouth!!

Comment 3 by Raymond Camden posted on 9/14/2013 at 5:04 PM

Ryan, you posted the *exact* same comment on two blog posts. That was not necessary. I'll reply more to the other one.

Comment 4 by Jasper posted on 9/27/2013 at 2:02 PM

i don't think I have phonegap installed

this is what it showed in the last 2 lines of nom

npm ERR! cb() never called!
npm ERR! not ok code 0

when i tried phonegap -v:
-bash: phonegap: command not found

Comment 5 by Raymond Camden posted on 9/27/2013 at 4:40 PM

@Jasper: Best I can suggest is to try install phonegap again via npm.

Comment 6 by Carlos posted on 2/13/2014 at 8:01 PM

Hi Raymond! I got some issues on Phonegap 3.3, can I revert the Phonegap version to previous 3.2?

Comment 7 by Raymond Camden posted on 2/13/2014 at 8:04 PM

I believe so. I'd check the npm docs. I think there is a way to grab previous versions.

Comment 8 by Nikki posted on 4/19/2014 at 7:58 PM

Hi Raymond. Glad I found you. I am beyond an embryo at all of this. I have phonegap installed and was informed to upgrade. followed instructions and believe it is but when I log on it still say upgrade. In my terminal this shows:

phonegap -v
3.4.0-0.19.17

is there something else i am to do after this? thanks in advance.

Comment 9 by Raymond Camden posted on 4/19/2014 at 11:43 PM

That is the most recent version. You say, "when you logon..." - what do you mean by that?

Comment 10 by NIkki posted on 4/21/2014 at 5:09 PM

When I log in to phone gap direct from on the website. It says your app is not currently utilizing the newest version. The connection isn't being made. I use dreamweaver to build and phone gap for emulator.

Comment 11 by Raymond Camden posted on 4/21/2014 at 5:26 PM

Nikki, you are talking about PhoneGap Build. You didn't make that very clear. PGB is telling you that the app you uploaded, at some time in the past, is now using an older version. You can - normally - ignore this. If tomorrow we release 4.0 on PGB, then your apps will be marked as using an older version. This is normal.

As to your second thing, "connection isn't being made" - I have no idea what you mean there. Perhaps you can clarify?

Comment 12 by Martin Cisneros posted on 4/26/2014 at 9:20 AM

Thank you very much!

Comment 13 by VinaySC posted on 1/18/2016 at 1:14 PM

Thanks for the info!

Comment 14 by Sathiyaraj Ramamurthy posted on 2/18/2016 at 10:07 AM

Hi,
I have currently using cordova 3.5.1. How cloud i update latest cordova version.
npm update -g cordova
This command not working for my machine. Can give me a solution for this.

Comment 15 (In reply to #14) by Raymond Camden posted on 2/18/2016 at 12:19 PM

How is it not working? What error do you get?

Comment 16 (In reply to #15) by Sathiyaraj Ramamurthy posted on 2/18/2016 at 12:52 PM

I did get any error. But add a cordova build android means not working

Comment 17 (In reply to #16) by Raymond Camden posted on 2/18/2016 at 12:59 PM

Did not? Or did? And if building android didn't work, *how* didn't it work? What error?

Comment 18 (In reply to #16) by Sathiyaraj Ramamurthy posted on 2/18/2016 at 2:11 PM

where i check the log file

Comment 19 (In reply to #18) by Raymond Camden posted on 2/18/2016 at 2:29 PM

Are you asking where the log is? I do not understand you.

Comment 20 (In reply to #18) by Sathiyaraj Ramamurthy posted on 2/18/2016 at 3:41 PM

Exception in thread "main" org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]

Comment 21 (In reply to #20) by Raymond Camden posted on 2/18/2016 at 3:46 PM

That's not very clear. The most recent version of the Cordova CLI is 6.0.0. I'd ensure you are updated and double check the docs for the Android platform to ensure you have done all the prereqs.

Comment 22 by Nettoyer le Marécage posted on 4/2/2020 at 6:39 AM

Hi Raymond; When I entered "npm info phonegap version", I got as follows:

9.0.0

┌─────────────────────────────┐
│ npm update check failed
│ Try running with sudo or get access
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /Users/myname/.config │
└─────────────────────────────┘

Is that 9.0 the phonegap version? Does that command try to update to a newer version if one exists?
Thanks.

Comment 23 (In reply to #22) by Raymond Camden posted on 4/3/2020 at 1:10 PM

Um sorry - I haven't used PhoneGap in maybe 3+ years.