内容
状態:-
閲覧数:741
投稿日:2018-07-22
更新日:2018-08-07
一覧
0.PhoneGap CLIインストール要件
1.PhoneGap CLIインストール
phonegap to update
ヘルプページ表示
0.PhoneGap CLIインストール要件
下記2つが必要
Node.js
・JavaScriptコードをビルドするためのJavaScriptランタイム。
Git
事前確認
>git
'git' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
>npm install -g phonegap@latest
'npm' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
インストール対応
・「Windows10」へ「Node.js10.7.0 (includes npm 6.1.0)」をインストール
・「Windows10」へ「gitfor windows VERSION 2.18.0」をインストール
1.PhoneGap CLIインストール
コマンドプロンプト起動
キーボードのスタートボタン(Windowsマークのボタン) + Rを押下
・cmdと入力してOKを押下
コマンド入力
下記npmコマンドの意味
・ローカルマシンで実行するために必要なPhoneGap CLIの依存関係を取得する
・これにより、CLIを実行するために必要なコードを含むnode_modulesフォルダーが作成される
・-gフラグは、マシン上のどこからでもアクセスできるよう、このフォルダーがグローバルな場所にインストールされるよう指定
C:\Users\★★>npm install -g phonegap@latest
npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
C:\Users\★★\AppData\Roaming\npm\phonegap -> C:\Users\★★\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\phonegap\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ phonegap@8.0.0
added 711 packages from 500 contributors in 110.204s
コマンドラインで「phonegap」と入力して、PhoneGap CLIが正しくインストールされていることを確認するテストを行う
・ヘルプテキストが出力されればOK
C:\Users\★★>phonegap
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 (to a push-notification-compatible application)
analytics turn analytics on or off, or view current status
report-issue opens your browser and launches github.com with a ready to report issue
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.json
Examples:
$ phonegap help create
$ phonegap create path/to/my-app
$ cd my-app/
$ phonegap run ios
$ phonegap analytics on
╭─────────────────────────────────────╮
│ │
│ Update available 6.5.2 → 8.0.0 │
│ Run npm i -g phonegap to update │
│ │
╰─────────────────────────────────────╯
C:\Users\★★>
phonegap to update
C:\Users\★★>npm i -g phonegap to update
npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\★★\AppData\Roaming\npm\phonegap -> C:\Users\★★\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
C:\Users\★★\AppData\Roaming\npm\update -> C:\Users\★★\AppData\Roaming\npm\node_modules\update\bin\update.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\phonegap\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ to@0.2.9
+ update@0.7.4
+ phonegap@8.0.0
added 672 packages from 180 contributors and updated 3 packages in 122.837s
C:\Users\★★>
ヘルプページ表示
2種類
キーワードのhelpを追加するか、phonegapコマンドに-hまたは--h属性を追加すると、いつでもPhoneGap CLIの使用法にアクセスできる
キーワードのhelpを追加
C:\Users\★★>phonegap create help
Usage: phonegap create [options] <path> [id [name [config]]]
Description:
Creates a new application at the provided path.
The application name and package ID can also be customized.
These values are set in the app manifest (config.xml) and are used when
creating a native project (platforms/<platform>/).
The application can be created from an existing template as well. You can
use any template that is published on npm, in your local file path, or available
from a git URL. PhoneGap also recommends a few popular templates and provides
shortened names for each. You can list the recommended templates with the
`template list` command.
The [config] option allows you to pass a JSON string, which will be injected
into `<path>/.cordova/config.json`.
Options:
--name, -n <name> application name (default: "Hello World")
--id, -i <package> package name (default: "com.phonegap.hello-world")
--copy-from, -src <path> create project using a copy of an existing project
--link-to <path> symlink/shortcut to the www assets without copying
--template <npm package|path|git url> create app using template found on npm,
your local path, or a git URL.
Examples:
$ phonegap create path/to/my-app
$ phonegap create path/to/my-app "com.example.app" "My App"
$ phonegap create path/to/my-app --id "com.example.app" --name "My App"
$ phonegap create path/to/my-app --copy-from ../my-other-app
$ phonegap create path/to/my-app --template hello-world
$ phonegap create path/to/my-app --template phonegap-template-hello-world
Also See:
$ phonegap help template
$ phonegap help template list
C:\Users\★★>
phonegapコマンドに-hまたは--h属性を追加
C:\Users\★★>phonegap serve -h
Usage: phonegap serve [options]
Description:
Serves the application on a local web server.
The intended receiver is the PhoneGap App, but any
browser can consume the content.
Options:
--port, -p <n> port for web server (default: 3000)
--autoreload enable app refresh on file changes (default: true)
--no-autoreload disable app refresh on file changes
--browser enable desktop browser support (default: true)
--no-browser disable desktop browser support
--console enable console.log support to the terminal (default: true)
--no-console disable console.log support to the terminal
--deploy enable the app to actually load updates or new apps from the server when already connected (default: true)
--no-deploy disable the app from loading updates or new apps when already connected
--homepage enable three-finger tap to go back to the server input page (default: true)
--no-homepage disable three-finger tap
--localtunnel enable a local tunnel for public access (default: false)
--push enable the app to register for push notifications
--no-push disable the app from registering push notifications
--proxy enable the browser to make xhr calls using a proxy
--no-proxy disable proxying on the browser
--refresh enable four finger tap to refresh to the app's current page (default: true)
--no-refresh disable four finger tap
Alias:
phonegap app
Examples:
$ phonegap serve
$ phonegap serve --port 1337
$ phonegap serve --no-autoreload
$ phonegap serve --browser
$ phonegap serve --no-browser
$ phonegap serve --console
$ phonegap serve --no-console
$ phonegap serve --homepage
$ phonegap serve --no-homepage
$ phonegap serve --localtunnel
$ phonegap app
C:\Users\★★>
・手順1: PhoneGapのインストール