2017年5月29日月曜日

node.js インストール


node.js install


Homebrew で nvm(Node Version Manager) をインストールします。

$ brew --version
Homebrew 1.2.1
Homebrew/homebrew-core (git revision 088b; last commit 2017-05-29)

$ brew install nvm
==> Using the sandbox
==> Downloading https://github.com/creationix/nvm/archive/v0.33.2.tar.gz
==> Downloading from https://codeload.github.com/creationix/nvm/tar.gz/v0.33.2
######################################################################## 100.0%
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.

You should create NVM's working directory if it doesn't exist:

  mkdir ~/.nvm

Add the following to ~/.bash_profile or your desired shell
configuration file:

  export NVM_DIR="$HOME/.nvm"
  . "/usr/local/opt/nvm/nvm.sh"

You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.

Type `nvm help` for further information.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary

🍺  /usr/local/Cellar/nvm/0.33.2: 7 files, 125.4KB, built in 4 seconds


なにやらいろいろでてます。
順番に対応します。

$ mkdir ~/.nvm
$ vi .bash_profile
で export NVM_DIR を追加します。

$ source .bash_profile

ここから node.js のインストールです。
バージョンを確認します。

$ nvm ls-remote
         (略)
         v7.7.4
         v7.8.0
         v7.9.0
        v7.10.0

最新版(v7.10.0)をインストールします。

$ nvm install 7.10.0
Downloading and installing node v7.10.0...
Downloading https://nodejs.org/dist/v7.10.0/node-v7.10.0-darwin-x64.tar.gz...
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v7.10.0 (npm v4.2.0)
Creating default alias: default -> 7.10.0 (-> v7.10.0)

$ node --version
v7.10.0

インストール完了ですー
確認してみます。

$ nvm ls
->      v7.10.0
default -> 7.10.0 (-> v7.10.0)
node -> stable (-> v7.10.0) (default)
stable -> 7.10 (-> v7.10.0) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> N/A)
lts/argon -> v4.8.3 (-> N/A)
lts/boron -> v6.10.3 (-> N/A)

デフォルトが v7.10.0 になっていることがわかりますね。

0 件のコメント:

コメントを投稿