Cordova的安装

参考来源:http://cordova.apache.org/#supported_platforms_section
http://cordova.apache.org/docs/zh-cn/6.x/guide/overview/index.html

文章提到:

Cordova command-line runs on Node.js and is available on NPM. Follow platform specific guides to install additional platform dependencies. Open a command prompt or Terminal, and type npm install -g cordova.

所以首先安装node,去官网:https://nodejs.org/en/ 根据说明来安装node!

1.安装Node

打开https://nodejs.org/en/ ,然后下载V4.6.0LTS.msi长期稳定版,并且安装
安装完成后,打开cmd输入命令:

node --version

检查安装情况,安装成功会输出内容:

v4.6.0

2.安装cordova

打开cmd命令行,输入命令:

npm install -g cordova

在linux下,可能会出错,需要加上sudo,

sudo apt-get install npm
sudo npm install -g cordova
sudo apt-get install nodejs-legacy

该命令执行成功后,输入命令:

cordova -help

如果显示的结果为:

Synopsis

    cordova command [options]

Global Commands
    create ............................. Create a project
    help ............................... Get help for a command
    telemetry .......................... Turn telemetry collection on or off

Project Commands
    info ............................... Generate project information
    requirements ....................... Checks and print out all the requirements
                                            for platforms specified

    platform ........................... Manage project platforms
    plugin ............................. Manage project plugins

    prepare ............................ Copy files into platform(s) for building
    compile ............................ Build platform(s)
    clean .............................. Cleanup project from build artifacts

    run ................................ Run project
                                            (including prepare && compile)
    serve .............................. Run project with a local webserver
                                            (including prepare)

Learn more about command options using 'cordova help '

Aliases
    build -> cordova prepare && cordova compile
    emulate -> cordova run --emulator

Options
    -v, --version ...................... prints out this utility's version
    -d, --verbose ...................... debug mode produces verbose log output for all activity,
    --no-update-notifier ............... disables check for CLI updates
    --nohooks .......................... suppress executing hooks
                                         (taking RegExp hook patterns as parameters)

Examples
    cordova create myApp org.apache.cordova.myApp myApp
    cordova plugin add cordova-plugin-camera --save
    cordova platform add android --save
    cordova requirements android
    cordova build android --verbose
    cordova run android
    cordova build android --release -- --keystore="..\android.keystore" --storePassword=android --alias=mykey

则说明安装成功!

你可能感兴趣的:(cordova)