2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macでAppCenter CLIを使う[準備編]

Last updated at Posted at 2018-08-21

流れ

  1. Node.jsnpmのインストール
  2. AppCenter CLIのインストール

1. Node.jsとnpmのインストール

1.1 nodeバージョン管理ツールをインストール

ターミナルで以下コマンドを実行

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

1.2 nodebrewのインストール

ターミナルで以下コマンドを実行

$ brew install nodebrew

正常にインストールされているかバージョン確認コマンドを実行して確認

$ nodebrew -v

こんな感じに表示されたらOK

出力
nodebrew 1.0.0

Usage:
    nodebrew help                         Show this message
    nodebrew install <version>            Download and install <version> (from binary)
    nodebrew compile <version>            Download and install <version> (from source)
    nodebrew install-binary <version>     Alias of `install` (For backword compatibility)
    nodebrew uninstall <version>          Uninstall <version>
    nodebrew use <version>                Use <version>
    nodebrew list                         List installed versions
    nodebrew ls                           Alias for `list`
    nodebrew ls-remote                    List remote versions
    nodebrew ls-all                       List remote and installed versions
    nodebrew alias <key> <value>          Set alias
    nodebrew unalias <key>                Remove alias
    nodebrew clean <version> | all        Remove source file
    nodebrew selfupdate                   Update nodebrew
    nodebrew migrate-package <version>    Install global NPM packages contained in <version> to current version
    nodebrew exec <version> -- <command>  Execute <command> using specified <version>

Example:
    # install
    nodebrew install v8.9.4

    # use a specific version number
    nodebrew use v8.9.4

1.3 Node.jsとnpmのインストール

最新のNode.jsをインストール
バージョンを指定したい場合はlatestの部分をv1.1.1のように変更すればOK
install-binaryでやってるのはinstallだと同時にコンパイルされちゃって時間がかかるから

$ nodebrew install-binary latest

こんなエラーが出たら

Fetching: https://nodejs.org/dist/v8.1.2/node-v8.1.2-darwin-x64.tar.gz
Warning: Failed to create the file 
Warning: /Users/take/.nodebrew/src/v8.1.2/node-v8.1.2-darwin-x64.tar.gz: No 
Warning: such file or directory
                                                                           0.0%
curl: (23) Failed writing body (0 != 941)
download failed: https://nodejs.org/dist/v8.1.2/node-v8.1.2-darwin-x64.tar.gz

ディレクトリを作ってあげると解決する

$ mkdir -p ~/.nodebrew/src

インストールされているかNode.jsのバージョンを確認する

$ nodebrew list

こんな感じで出力されたらOK

出力
v10.9.0

current: none

currentnoneになっているから、使用するバージョンを有効化してあげる

$ nodebrew use v10.9.0

こんな感じに出力されたらOK

出力
use v10.9.0

パスを通す
xxxxxにはpwdで確認できる

$ echo 'export PATH=$PATH:/Users/xxxxx/.nodebrew/current/bin' >> ~/.bashrc

更に.bashrcを.bash_profileで読み込むようにする
viか何かで~/.bash_profileを開いて

vi ~/.bash_profile

以下を追記

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

Node.jsのバージョンを確認する

$ node -v

こんな感じに出力されたらOK

出力
v10.9.0

npmのバージョンを確認する

$ npm -v

こんな感じに出力されたらOK

出力
v6.2.0

これでNode.jsnpmのインストールは終了

2. AppCenter CLIのインストール

以下コマンドを使用してインストールします

npm install -g appcenter-cli

バージョン確認コマンドを使用してインストールされているか確認します

appcenter --version

こんな感じに出力されたらOK

出力
appcenter version 1.1.1

これでAppCenter CLIを使うための準備は終了

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?