homebrew가 설치되있다는 하에
nvm 설치
$ sudo curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
.bash_profile 수정
나노로 .bash_profile 열기
nano ~/.bash_profile
다음 내용 추가
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
저장하고 나가기
ctrl + x
y
enter
.bash_profile 재시작
source ~/.bash_profile
확인
nvm ls
16.13.0 버전 설치
nvm install 16.13.0
버전 사용 및 변경
nvm use 사용할버전
현재 실행중인 버전 확인
node -v
n 설치
brew install n
.bash_profile 수정
나노로 .bash_profile 열기
nano ~/.bash_profile
다음 코드 추가
export N_PREFIX=$HOME/.n export PATH=$N_PREFIX/bin:$PATH
저장하고 나가기
ctrl + x
y
enter
.bash_profile 재시작
source ~/.bash_profile
16.13.0 버전 설치
sudo n 16.13.0
최신 버전 설치
sudo n latest
lts 버전 설치
sudo n lts
버전 사용 및 변경
sudo n
입력
up/down키로 원하는 버전 선택현재 실행중인 버전 확인
node -v