官术网_书友最值得收藏!

Installing Node via Homebrew

The quickest way to get Homebrew is to visit http://brew.sh and get hold of the installation script. It should look a little something like this:

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

Simply paste that into your Terminal and it'll download the Homebrew package manager to your Mac. We can then use brew install node to install Node on our system without any worries.

Once you've done that, check your Node installation works by typing node -v and npm -v. If you get two version numbers back (that is, one for each), then you’re ready to go ahead with the rest of the book!

In order to manage the different Node versions, we could also install the Node Version Manager (NVM). Do note however that this is currently only supported by Mac at present and not Windows. To install NVM, we can use Homebrew like so:

--use Brew to install the NVM
brew install nvm

--File directory
mkdir ~/.nvm

--Install latest version
nvm install --lts

--Ensure latest version is used
nvm use node

--Remember details across sessions
nano ~/.bash_profile

--Execute in every session
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
主站蜘蛛池模板: 全南县| 铜陵市| 邢台市| 板桥市| 东乌| 石棉县| 南漳县| 旺苍县| 大冶市| 巨鹿县| 虹口区| 嘉鱼县| 龙海市| 化德县| 普格县| 达拉特旗| 临桂县| 渝北区| 鄂托克旗| 江都市| 威远县| 永昌县| 洛川县| 泾阳县| 大庆市| 泗阳县| 调兵山市| 托克托县| 科技| 海口市| 陈巴尔虎旗| 西城区| 柘荣县| 灵石县| 汤阴县| 阿克陶县| 文山县| 河西区| 邹平县| 会同县| 兴山县|