LoginSignup
172
156

More than 5 years have passed since last update.

【2018年版】macのhomebrewでnodebrew入れてからnode.jsを入れるまで

Last updated at Posted at 2017-12-15

色々あって自分のmac book proを先日、工場出荷状態に戻しました…
なので開発環境の再構築中で、イケてるやり方で改めて構築してます

環境

  • OS High Sierra ver 10.13.2
  • homebrew インスコ済み

nodebrewをインストール

nodebrewとは
node.jsを自分のマシン内でversion管理するためのtool

git-hub nodebrew

1、homebrewでnodebrewをイントールして設定

$ brew install nodebrew

##install確認
$ brew list
nodebrew

##nodebrewセットアップ
$ nodebrew setup

2、環境変数の設定

.bash_profileに以下を追記

# nodebrew setup時に打つと出てきたやつ
export PATH=/usr/local/var/nodebrew/current/bin:$PATH
export PATH=$HOME/.nodebrew/current/bin:$PATH
#環境変数の反映
$ source .bash_profile

3、nodebrewを使って最新のnode.jsをインストール

latest = 最新版
stable = 安定版

#安定版のインストール
$ nodebrew install-binary stable

#インストール後の確認
$ nodebrew list

v8.9.3

current: none

#使用するための設定と、その確認
$ nodebrew use stable
$ node -v
v8.9.3

$ npm -v
5.5.1

#npmの更新
$ npm update -g npm

4、Done!!

node.jsインストール完了です
お疲れ様でした

172
156
2

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
172
156