Phonegap installation error (npm) Phonegap installation error (npm) windows windows

Phonegap installation error (npm)


Download the older version. I think there was a problem in the new one

npm install -g phonegap@3.4

I tried this and worked for me.


I had the same issue yesterday. If you check npm-debug.log, you'll notice that there is a permission issue ("Permission denied") when npm tries to access the cordova-lib git repository url. Actually, cordova-lib is a dependency for phonegap. So, it can't install it and I think that's why you get that error.

So, I tried this: install cordova-lib first then Phonegap. Yet, it still won't work; npm does not seem to check if cordova-lib is installed before trying to do it.At this point, what I could do is to change the repository from which it retrieves cordova-lib. Here is the NPM install syntax:

npm install <tarball file>npm install <tarball url>npm install <folder>npm install <pkg>npm install <pkg>@<tag>npm install <pkg>@<version>npm install <pkg>@<version range>

This means I can install from a tar.gz file. Great! So, I just went to this page https://www.npmjs.org/package/phonegap to check the phonegap repository and performed these steps:

  1. Download the zip of phonegap-cli repo (https://github.com/phonegap/phonegap-cli/archive/master.zip)
  2. Unzip it
  3. Open the package.json file and find the cordova-lib entry in dependencies (line 32)
  4. Change the value to 0.21.3 which is the last version.
  5. Recreate an archive of the folder to the tar.gz format
  6. Open your CLI and run this command:

    npm install -g path/to/archive/phonegap-cli-master.tar.gz

It should work now.

Hope that help!


I had a similar problem today too on Mac, even after Lorenzo said it should be all fine. Just running this:

sudo npm install -g phonegap

... produced loads of errors like this:

error: file ./objects/pack/pack-48c0ff4147fb7e8922546c4a857b98a1cb48e01f.pack is far too short to be a packfile

I combined Lorenzo and arpan shah's solutions:

sudo npm install -g phonegap@3.4sudo npm cache cleansudo npm update -g phone gap

... and it seemed to magically work.