본문 바로가기

Node

n으로 node 버전 변경이 안될 때

https://www.npmjs.com/package/n

 

n

Interactively Manage All Your Node Versions. Latest version: 9.0.1, last published: 5 months ago. Start using n in your project by running `npm i n`. There are 25 other projects in the npm registry using n.

www.npmjs.com

 

오류

node 버전 관리 툴로 n을 사용하는데

잘 사용하고있는데 어느날 갑자기

n [버전 명] 명령어를 사용해도 node -v를 해보면 노드 버전이 변경이 안될 때가 있습니다.

 

 

$ n 10.9.0
   installed : v10.9.0 to /opt/jenkins/n/bin/node
      active : v12.14.1 at /bin/node

n 명령어를 보면 installed 경로와 active 경로가 서로 달라서 발생하는 문제였습니다.

 

 

해결 방법

위와같은 경우에는 installed 경로와 active 경로만 일치 시켜주면 쉽게 해결이 가능합니다

아래 명령어를 실행합니다

ln -sf installed경로 active경로

 

 

참고 자료
https://velog.io/@jvn4dev/Nodejs-n-%EB%AA%A8%EB%93%88%EB%A1%9C-Node-%EB%B2%84%EC%A0%84-%EB%B3%80%EA%B2%BD%EC%9D%B4-%EC%95%88%EB%90%A0-%EB%95%8C