node.js 버전 업/다운그레이드 하기

node.js를 개발할때 version dependent한 상황이 발생한다. 이때 사용할 수 있는게 nvm 또는 n module이다.

우선 nvm을 살펴보자.

먼저 nvm을 설치한다.


$ curl https://raw.github.com/creationix/nvm/master/install.sh | sh
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100 1391 100 1391 0 0 694 0 0:00:02 0:00:02 --:--:-- 1074
Cloning into '/Users/account/.nvm'...
remote: Counting objects: 712, done.
remote: Compressing objects: 100% (478/478), done.
remote: Total 712 (delta 347), reused 567 (delta 223)
Receiving objects: 100% (712/712), 107.87 KiB | 66 KiB/s, done.
Resolving deltas: 100% (347/347), done.

=> Appending source string to /Users/account/.bash_profile
=> Close and reopen your terminal to start using NVM
$

설치가 되었다. path 설정을 위해 bash_profile을 재설정해준다.


$ source ~/.bash_profile

이제 원하는 node 버전을 다운받아 설치하고 사용해본다.

$ nvm install 0.10
$ nvm install 0.10.15
$ nvm use 0.10

다음 n을 살펴보자.

먼저 n 모듈을 설치한다.


$ npm install -g n

다음 원하는 node 버전을 몇가지 선택하여 설치한다.


$ n 0.8.14
$ n 0.8.17
$ n 0.9.6

이후 node 버전을 선택하면 손쉽게 switch할 수 있다.


$ n

0.8.14
ο 0.8.17
 0.9.6

참고로 Ruby은 rvm이라는 툴을 제공하여 손쉽게 ruby 버전을 관리할 수 있는데, nvm은 의미상 유사한 개념이라 볼 수 있겠다.

About musart
hello

Leave a comment