node.js / npm 버전 업데이트

참조 : http://www.tutorialbook.co.kr/entry/NodeJS-%EC%97%85%EB%8D%B0%EC%9D%B4%ED%8A%B8-%ED%95%98%EA%B8%B0


n이 설치되어 있지 않은 경우 (처음 시도할 경우)
1. npm 캐시를 아래와 같이 청소해주고
# sudo npm cache clean -f
npm WARN using –force I sure hope you know what you are doing

2. node.js 버전관리 모듈인 n을 설치하고
# sudo npm install -g n


3. n으로 node.js를 최신 안정버전으로 설치를 합니다.
# sudo n stable

4. 버전을 확인해 보죠
# node -v
v5.2.0

n을 통해서 다운그레이드도 가능한가 봅니다.
# sudo n 0.10.28

5. 마지막으로 npm도 업데이트를 해줘야 한답니다.
# npm update npm -g
–> 아래와 같은 로그가 나왔는데, 명령어를 다시 시도해 보니 정상 업데이트 되었었다.

npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.

–> 정상 설치되었을 때의 로그/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
– graceful-fs@3.0.8 node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs
– ansi-regex@0.2.1 node_modules/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex
– github-url-from-git@1.4.0 node_modules/npm/node_modules/github-url-from-git


n이 설치되어 있는 경우
1. npm 캐시를 아래와 같이 청소해주고
# sudo npm cache clean -f
npm WARN using –force I sure hope you know what you are doing

2. n으로 node.js를 최신 안정버전으로 설치를 합니다.
# sudo n stable

3. 마지막으로 npm도 업데이트를 해줘야 한답니다.
# npm update npm -g

4. 버전을 확인해 보죠
# node -v
v5.6.0
# npm -v
v3.7.4

댓글 남기기