安装Phonegap CLI

  在安装Phonegap CLI之前,必须满足两个条件,1、已安装node.js 2、已安装git 

  之前没有接触过node.js.现在先安装node.js.

  第一步:打开终端,输入以下命令安装Homebrew

  

wenqings-iMac:~ bunsei$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";


第二步:安装node,在终端输入以下命令

wenqings-iMac:~ bunsei$ brew install node


第三步 查看node安装成功与否

wenqings-iMac:~ bunsei$ node -v

获取到结果

v6.5.0


之前已经安装了Git,现在可以直接安装PhoneGap CLI

运行一下命令

wenqings-iMac:~ bunsei$ sudo npm install -g phonegap@latest

报警告

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.

npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

运行下面命令试图解决上述警告的问题

wenqings-iMac:~ bunsei$ sudo npm install minimatch@"3.0.2"


结果报另外的警告

/Users/bunsei

└── minimatch@3.0.2 


npm WARN enoent ENOENT: no such file or directory, open '/Users/bunsei/package.json'

npm WARN bunsei No description

npm WARN bunsei No repository field.

npm WARN bunsei No README data

npm WARN bunsei No license field.


继续解决问题

wenqings-iMac:~ bunsei$ cd /Users/bunsei/

wenqings-iMac:~ bunsei$ ls -a

获取一下结果

. .gemrc Documents

.. .git Downloads

.CFUserTextEncoding .gitconfig Library

.DS_Store .itmstransporter Movies

.Trash .npm Music

.bash_history .putty Pictures

.bash_sessions .sogouinput Public

.cocoapods .subversion node_modules

.emacs.d .viminfo simplegit-progit

.gem Desktop


继续解决问题

wenqings-iMac:~ bunsei$ sudo npm install -g minimatch

获取以下结果

/usr/local/lib

└─┬ minimatch@3.0.3 

  └─┬ brace-expansion@1.1.6 

    ├── balanced-match@0.4.2 

    └── concat-map@0.0.1 

最后验证一下是否安装好phonegap

wenqings-iMac:~ bunsei$ phonegap


How you use PhoneGap provides us with important data that we can use to make

our products better. Please read our privacy policy for more information on the

data we collect. http://www.adobe.com/privacy.html

? Would you like to allow PhoneGap to collect anonymous usage data? (Y/n) 

Analytics is off. 

If you would like to turn analytics on, simply run `phonegap analytics on`



Usage: phonegap [options] [commands]


Description:


  PhoneGap command-line tool.


Commands:


  help [command]       output usage information

  create <path>        create a phonegap project

  build <platforms>    build the project for a specific platform

  install <platforms>  install the project on for a specific platform

  run <platforms>      build and install the project for a specific platform

  platform [command]   update a platform version

  plugin [command]     add, remove, and list plugins

  template [command]   list available app templates

  info                 display information about the project

  serve                serve a phonegap project

  version              output version number

  push                 send test push notification

  analytics            turn analytics on or off, or view current status


Additional Commands:


  local [command]      development on local system

  remote [command]     development in cloud with phonegap/build

  prepare <platforms>  copies www/ into platform project before compiling

  compile <platforms>  compiles platform project without preparing it

  emulate <platforms>  runs the project with the flag --emulator

  cordova              execute of any cordova command


Options:


  -d, --verbose        allow verbose output

  -v, --version        output version number

  -h, --help           output usage information

  --no-update-notifier disable update notifier, to opt-out of update-notifier

                       change the 'optOut' property to 'true' in

                       ~/.config/configstore/update-notifier-phonegap.yml


Examples:


  $ phonegap help create

  $ phonegap create path/to/my-app

  $ cd my-app/

  $ phonegap run ios

  $ phonegap analytics on


wenqings-iMac:~ bunsei$ phonegap analytics on


Analytics is on! Nice, you are helping us improve PhoneGap tooling.

If you would like to turn analytics off, simply run `phonegap analytics off`


wenqings-iMac:~ bunsei$ 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值