먼저 기본적으로 노드가 설치되어 있다는 가정하에

npm 명령어로 n 을 쉽게 설치할 수 있다.

npm install -g n

 

n의 기본 경로는 /usr/local 아래에 설치되기 때문에 sudo 권한이 필요하다.

따로 prefix를 지정해도 되지만, 아래처럼 권한을 주도록 하자.

# make cache folder (if missing) and take ownership
sudo mkdir -p /usr/local/n
sudo chown -R $(whoami) /usr/local/n

# make sure the required folders exist (safe to execute even if they already exist)
sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share

# take ownership of Node.js install destination folders
sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share

 

이제 n 을 입력해서 사용할 노드 버전을 설정할 수 있다.
방향키로 선택 후 엔터로 바로 적용 가능하다!

 

주요 n 의 기능

n 다운로드 된 Node.js 버전 선택
n latest 가장 최신 Node.js release 다운로드
n lts 가장 최신 LTS(안정화 버전) release 다운로드
n 특정버전 특정 버전 Node.js 다운로드
n which 특정버전 설치된 Node.js path 위치 확인
n rm 특정버전 다운로드된 특정 Node.js 버전 삭제
n ls 다운로드된 Node.js 버전 리스트 확인
n uninstall 설치된 Node.js 삭제

 

 

 

 

+ Recent posts