관리 메뉴

웹개발자의 기지개

[Node.js] Node.js 윈도우/Mac 설치, NVM 으로 Node.js 여러가지 버전 설치 본문

javascript/Node.js

[Node.js] Node.js 윈도우/Mac 설치, NVM 으로 Node.js 여러가지 버전 설치

http://portfolio.wonpaper.net 2023. 9. 15. 23:51

 

https://nodejs.org

 

Node.js

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

 

1. node.js 설치
https://nodejs.org 에서 안정화 버전 설치한다.
node -v 로 확인

: 자동으로 npm 은 같이 깔린다.
npm -v 로 확인

Visual Code 를 이용할때 플러그인 설치한다.
(1) Vetur - Vue 개발할때 확장 프로그램
(2) Debugger for Chrome (deprecated)
(3) Prettier - code formatter

 

성능향상을 위하여 yarn 도 설치한다.
npm install --global yarn

 

만약 아래처럼 에러발생한다면,
npm WARN config global --global --local are deprecated. Use --location=global instead 해결하기

 

https://ssjeong.tistory.com/entry/VUE-npm-WARN-config-global-global-local-are-deprecated-Use-locationglobal-instead

 

[VUE] npm WARN config global --global, --local are deprecated. Use --location=global instead

안녕하세요! 프뚜(프로그래머 뚜)입니다! [개발 환경] - OS: windows 10 64bit 위 에러는 npm-windows-upgrade 패키지로 해결할 수 있습니다. 1. PowerShell(관리자 권한)을 실행하기 2. 아래 명령어로 세팅 및 설

ssjeong.tistory.com

에서 해결한다음 다시 yarn 설치 시도한다.

yarn -v 설치확인

 

 

[ NVM을 이용한 node 버전 관리 (Window, Mac) ]

 

<윈도우>

https://github.com/coreybutler/nvm-windows/releases

 

Releases · coreybutler/nvm-windows

A node.js version management utility for Windows. Ironically written in Go. - coreybutler/nvm-windows

github.com

nvm-setup.exe 다운후 설치한다.

nvm version 설치확인


<맥OS>

brew 가 설치되어 있다고 가정한다.
nvm 설치하기
brew install nvm

nvm 환경변수 설정
# nvm 관련 파일들이 저장될 디렉토리 생성
mkdir ~/.nvm

# .bash_profile을 수정
vi ~/.bash_profile

위의 코드를 실행하고 나온 창 맨 하단데 아래의 내용 복사 & 붙여넣기
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"

수정 내용을 적용시키기
source ~/.bash_profile

nvm 버전 확인
nvm version


[ NVM을 사용하여 Node 설치, 적용, 삭제해보기 ]

# 설치 가능 버전 확인
nvm list available

# 사용 중인 버전으로 예시
nvm install 14.18.3

설치된 버전 확인
nvm ls

# 설치한 버전 적용
nvm use 14.18.3


# 노드 버전확인
node --version

# 특정 버전 삭제
nvm uninstall 14.18.3

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
C:\Windows\system32>
C:\Windows\system32>nvm ls
 
  * 18.16.1 (Currently using 64-bit executable)
 
C:\Windows\system32>node --version
v18.16.1
 
C:\Windows\system32>nvm list available
 
|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
|    20.6.1    |   18.17.1    |   0.12.18    |   0.11.16    |
|    20.6.0    |   18.17.0    |   0.12.17    |   0.11.15    |
|    20.5.1    |   18.16.1    |   0.12.16    |   0.11.14    |
|    20.5.0    |   18.16.0    |   0.12.15    |   0.11.13    |
|    20.4.0    |   18.15.0    |   0.12.14    |   0.11.12    |
|    20.3.1    |   18.14.2    |   0.12.13    |   0.11.11    |
|    20.3.0    |   18.14.1    |   0.12.12    |   0.11.10    |
|    20.2.0    |   18.14.0    |   0.12.11    |    0.11.9    |
|    20.1.0    |   18.13.0    |   0.12.10    |    0.11.8    |
|    20.0.0    |   18.12.1    |    0.12.9    |    0.11.7    |
|    19.9.0    |   18.12.0    |    0.12.8    |    0.11.6    |
|    19.8.1    |   16.20.2    |    0.12.7    |    0.11.5    |
|    19.8.0    |   16.20.1    |    0.12.6    |    0.11.4    |
|    19.7.0    |   16.20.0    |    0.12.5    |    0.11.3    |
|    19.6.1    |   16.19.1    |    0.12.4    |    0.11.2    |
|    19.6.0    |   16.19.0    |    0.12.3    |    0.11.1    |
|    19.5.0    |   16.18.1    |    0.12.2    |    0.11.0    |
|    19.4.0    |   16.18.0    |    0.12.1    |    0.9.12    |
|    19.3.0    |   16.17.1    |    0.12.0    |    0.9.11    |
|    19.2.0    |   16.17.0    |   0.10.48    |    0.9.10    |
 
This is a partial list. For a complete list, visit https://nodejs.org/en/download/releases
 
C:\Windows\system32>nvm install 16.20.2
Downloading node.js version 16.20.2 (64-bit)...
Extracting node and npm...
Complete
npm v8.19.4 installed successfully.
 
Installation complete. If you want to use this version, type
 
nvm use 16.20.2
 
C:\Windows\system32>node -v
v18.16.1
 
C:\Windows\system32>npm -v
9.5.1
 
C:\Windows\system32>nvm use 16.20.2
Now using node v16.20.2 (64-bit)
 
C:\Windows\system32>node -v
v16.20.2
 
C:\Windows\system32>npm -v
8.19.4
cs

 

 

https://nodejs.org/en/download/releases

 

Previous Releases | Node.js

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

 

참고 : https://ssjeong.tistory.com/entry/VUE-yarn-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0

참고 : https://daechu.tistory.com/47

 

Comments