安装PhoneGap 3.x

当使用npm安装PhoneGap 3.X时,会收到一些错误,如下图所示:

PhoneGap的安装

注意:我已经安装了NodeJS

尝试安装旧版本:

npm install -g phonegap@3.4 

但是,如果你想安装最新版本。 按照这篇文章中build议的步骤。

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

您可以在安装时添加版本号。 例如:

 npm install -g phonegap@3.4 

希望对你有帮助。