LoginSignup
2
5

More than 5 years have passed since last update.

Homebrewでnodeのバージョンを上げました

Posted at

nodeのバージョンを上げたかったのですがやり方がわかりませんでした。環境はMacです。

nodeのバージョンが古いと言われる

コマンドを実行したら、実行できませんでした。

とあるコマンドを実行
You are currently running Node v0.12.7 but create-react-app requires >=4. Please use a supported version of Node.

nodeが4以上じゃないとだめとあります。

nodeのバージョンを確認

nodeのバージョンを見てみます。

nodeのバージョン
node -v

v0.12.7

先程の通り、ver0.12.7でした。

nodeをインストールしようとすると失敗

nodeをインストールしてみました。

brew install node
Updating Homebrew...
Error: node-0.12.7 already installed
To install this version, first `brew unlink node`

unlink nodeしろと書いてあります。

unlink node

unlink nodeを実行してみます。

nodeをunlink
brew unlink node
Unlinking /usr/local/Cellar/node/0.12.7... 6 symlinks removed

nodeをインストール

再度nodeのインストールを試します。

nodeをインストール
brew install node

略
==> Summary
🍺  /usr/local/Cellar/node/7.1.0: 3,884 files, 45.4M

今度はインストールが成功しました。

nodeのバージョンを確認

再度nodeのバージョンを確認します。

nodeのバージョン
node -v
v7.1.0

バージョンがあがりましたやったね(☝ ՞ਊ ՞)

nodeが入ったというディレクトリを見てみる

nodeがインストールされたディレクトリを見てみます。

nodeのディレクトリを確認
ll /usr/local/Cellar/node/

0.10.22/ 0.12.7/  7.1.0/

以前のバージョンのディレクトリが残っています。unlinkというのはこの参照を消すみたいな感じなのかもですね。

2
5
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
5