phonegap官网: http://phonegap.com/
第一部:安装nodejs
安装地址:http://nodejs.org/
安装phoneGap 官网下载http://phonegap.com/install/
$ sudo npm install -g phonegap 这部安装可能慢些,耐心等待下
安装成功
usr/local/bin/phonegap -> /usr/local/lib/node_modules/phonegap/bin/phonegap.js
[email protected] /usr/local/lib/node_modules/phonegap
├── [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], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
第二部 修改local 文件夹权限
sudo chown -R $USER /usr/local
sudo chmod -R 0775 /usr/local
第三部分
npm install -g cordova
第四部分
cd /usr/local/lib/node_modules/phonegap/lib/phonegap
$ phonegap create my-app
安装成功
[phonegap] missing library phonegap/www/3.4.0
[phonegap] downloading https://github.com/phonegap/phonegap-app-hello-world/archive/3.4.0.tar.gz...
[phonegap] the options undefined /usr/local/lib/node_modules/phonegap/lib/phonegap/my-app com.phonegap.helloworld HelloWorld
[phonegap] created project at /usr/local/lib/node_modules/phonegap/lib/phonegap/my-app
localhost:my-app lsr$ ls
hooks merges platformspluginswww
www目录中存放的是HTML/JS/CSS
以及一个res子目录。其中res目录存放多个平台的图标与启动画面。
platforms目录目前是空的,建立多个平台的工程时会在此目录中新增相应的工程目录。
plugins目录目前是空的,新增插件的时候会下载到此目录中。
第五部分
phonegap run ios
创建成功
detecting iOS SDK environment...
[phonegap] using the local environment
[phonegap] adding the iOS platform...
[phonegap] missing library cordova/ios/3.4.0
[phonegap] downloading https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;a=snapshot;h=3.4.0;sf=tgz...
[phonegap] compiling iOS...
Build settings from command line:
ARCHS = i386
CONFIGURATION_BUILD_DIR = /usr/local/lib/node_modules/phonegap/lib/phonegap/my-app/platforms/ios/build/emulator
SDKROOT = iphonesimulator7.0
VALID_ARCHS = i386
=== BUILD TARGET CordovaLib OF PROJECT CordovaLib WITH CONFIGURATION Debug ===
** BUILD SUCCEEDED **
[phonegap] successfully compiled iOS app
[phonegap] trying to install app onto device
Error: ios-deploy was not found. Please download, build and install version 1.0.4 or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/
[phonegap] no device was found
[phonegap] trying to install app onto emulator
[warning] missing ios-sim
[warning] install ios-sim from http://github.com/phonegap/ios-sim
Error: ios-sim was not found. Please download, build and install version 1.7 or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/
[error] /usr/local/lib/node_modules/phonegap/lib/phonegap/my-app/platforms/ios/cordova/run: Command failed with exit code 1
我们在platforms 文件夹里打开工程
- 顶
- 0
- 踩
- 0