好记性赶不上烂笔头,回头来看才发现是真理!

废话不说了,开始流水账。所有操作均基于Mac


旧环境:

$npm version

{ http_parser: '1.0',

  node: '0.10.32',

  v8: '3.14.5.9',

  ares: '1.9.0-DEV',

  uv: '0.10.28',

  zlib: '1.2.3',

  modules: '11',

  openssl: '1.0.1i',

  npm: '2.1.6' }

$cordova -v   

3.0.0


更新安装:

$sudo npm install -g cordova

npm WARN engine cordova-serve@0.1.3: wanted: {"node":">= 0.12.0","npm":">= 2.5.1"} (current: {"node":"0.10.32","npm":"2.1.6"})

/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova

cordova@5.3.1 /usr/local/lib/node_modules/cordova

├── underscore@1.7.0

├── q@1.0.1

├── nopt@3.0.1 (abbrev@1.0.7)

└── cordova-lib@5.3.1 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, unorm@1.3.3, semver@4.3.6, shelljs@0.3.0, cordova-app-hello-world@3.9.0, npm@2.14.5, dep-graph@1.1.0, rc@0.5.2, xcode@0.8.0, elementtree@0.1.6, plist@1.1.0, npmconf@2.1.2, glob@4.0.6, request@2.47.0, cordova-registry-mapper@1.1.11, cordova-serve@0.1.3, tar@1.0.2, init-package-json@1.9.1, aliasify@1.7.2, cordova-js@4.1.1)


似乎版本低了点,

安装nodejs   v4.1.1    Mac 直接使用pkg包安装了。。。

附下载地址:  https://nodejs.org/dist/

$npm version

{ npm: '2.14.4',

  ares: '1.10.1-DEV',

  http_parser: '2.5.0',

  modules: '46',

  node: '4.1.1',

  openssl: '1.0.2d',

  uv: '1.7.4',

  v8: '4.5.103.33',

  zlib: '1.2.8' }


再次更新cordova

$sudo npm install -g cordova

Password:

npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.1.1","npm":"2.14.4"})

/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova

cordova@5.3.1 /usr/local/lib/node_modules/cordova

├── underscore@1.7.0

├── q@1.0.1

├── nopt@3.0.1 (abbrev@1.0.7)

└── cordova-lib@5.3.1 (valid-identifier@0.0.1, unorm@1.3.3, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, semver@4.3.6, dep-graph@1.1.0, shelljs@0.3.0, xcode@0.8.0, rc@0.5.2, elementtree@0.1.6, cordova-app-hello-world@3.9.0, cordova-serve@0.1.3, glob@4.0.6, npmconf@2.1.2, request@2.47.0, aliasify@1.7.2, cordova-registry-mapper@1.1.11, tar@1.0.2, plist@1.1.0, init-package-json@1.9.1, npm@2.14.5, cordova-js@4.1.1)

又提示尼玛。。xmlbuilder@2.2.1  对应的node 版本过高。   先不管了

$cordova -v

5.3.1


安装了 PhoneGapDesktop  这边直接使用的dmg安装包

附下载地址:https://github.com/phonegap/phonegap-app-desktop/tree/master/installers


完了使用 PhoneGapDesktop工具生成一个项目,或者直接使用cordova命令行生成

$ cordova create hello com.example.hello HelloWorld


基础操作步骤 详见 cordova 参考文件

附地址: http://cordova.apache.org/docs/en/5.0.0//guide_cli_index.md.html#The%20Command-Line%20Interface



待续