好记性赶不上烂笔头,回头来看才发现是真理!
废话不说了,开始流水账。所有操作均基于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 [email protected]: 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
[email protected] /usr/local/lib/node_modules/cordova
├── [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])
似乎版本低了点,
安装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 [email protected]: 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
[email protected] /usr/local/lib/node_modules/cordova
├── [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].6, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
又提示尼玛。。[email protected] 对应的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
待续