Alexa Skills Kit Command Line Interface (ASK CLI)をセットアップします。
前提条件
-
Amazon Developerアカウントを有していること。
1. nodeのインストール (nodebrewを使う場合)
コマンド
curl -L git.io/nodebrew | perl - setup
結果
Fetching nodebrew...
Installed nodebrew in $HOME/.nodebrew
========================================
Export a path to nodebrew:
export PATH=$HOME/.nodebrew/current/bin:$PATH
========================================
~/.bashrcにPATHを追記します。
.bashrcに追記
echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bashrc
コマンド
. ~/.bashrc
コマンド
which nodebrew
結果(例)
/Users/taro/.nodebrew/current/bin/nodebrew
nodeをバイナリでインストールします。(v6.10.0の例)
コマンド
nodebrew install-binary v6.10.0
コマンド
nodebrew use v6.10.0
node -v
結果(例)
v6.10.0
自動的にnpmもインストールされているはずです。
コマンド
which npm
結果(例)
/Users/taro/.nodebrew/current/bin/npm
コマンド
npm -v
結果(例)
3.10.10
2. ASK CLIのインストール
コマンド
npm install -g ask-cli
コマンド
which ask
結果(例)
<HOMEディレクトリ>/.nodebrew/current/bin/ask
3. ASKの初期化
コマンド
ask init --no-browser
出力
There is no AWS credentials setup yet, do you want to continue the initialization? (Default: False)
入力
Y
出力
Paste the following url to your browser:
<URL>
? Please enter your Authorization Code:
- をコピーしてブラウザのURL欄に貼り付けます。
- "OK"(ボタン)をクリックします。
- Authorization Codeが表示されるので、黒い枠の中のテキストをコピーします。
- 上記でターミナルに表示されている"Please enter your Authorization Code:"の後ろにペーストし、エンターキーを押します。
出力
Tokens fetched and recorded in ask-cli config.
Vendor ID set as XXXXXXXXXXXX
Profile [default] initialized successfully.
4. 事後確認
コマンド
ask init -l
結果(例)
Profile Associated AWS Profile
[default] <プロファイル名>
~/.ask/cli_configに認証情報が保存されています。