๊ฐœ๋ฐœ ๐Ÿพ/ETC

node ๋ฒ„์ „์„ ์—ฌ๋Ÿฌ๊ฐœ ์“ฐ๊ณ ์‹ถ๋‹ค๋ฉด NVM์„ ์จ๋ณด์ž

JOTOKKI 2023. 6. 6. 00:19
728x90

Node.js๋Š” ๋‹ค๋“ค ์•Œ๋‹ค์‹œํŒŒ ์›น ๋ธŒ๋ผ์šฐ์ € ์™ธ๋ถ€์—์„œ JavaScript ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” JavaScript ๋Ÿฐํƒ€์ž„ ํ™˜๊ฒฝ์ด์ฃ ?

๋Œ€๋ถ€๋ถ„์˜ ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์ž๋“ค์€ NPM์„ ์„ค์น˜ํ•˜์—ฌ node์˜ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. 

 

๊ทธ๋ ‡๋‹ค๋ฉด NVM์€ ๋ฌด์—‡์ผ๊นŒ์š”?

NVM์€ Node Version Manager์˜ ์•ฝ์ž๋กœ, ์ปดํ“จํ„ฐ์—์„œ ์—ฌ๋Ÿฌ ๋ฒ„์ „์˜ Node.js๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. 
NVM์„ ์‚ฌ์šฉํ•˜๋ฉด ์ปดํ“จํ„ฐ์˜ ๋‹ค๋ฅธ Node.js ๋ฒ„์ „ ๊ฐ„์— ์‰ฝ๊ฒŒ ์ „ํ™˜ํ•˜๊ณ , ํŠน์ • ๋ฒ„์ „์„ ์„ค์น˜ ๋ฐ ์ œ๊ฑฐํ•˜๋ฉฐ, ๊ธ€๋กœ๋ฒŒ ๋ฐ ํ”„๋กœ์ ํŠธ๋ณ„ Node.js ๋ฒ„์ „์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์„œ๋กœ ๋‹ค๋ฅธ ๋ฒ„์ „์˜ Node.js๋ฅผ ์„œ๋กœ ๋‹ค๋ฅธ ๋””๋ ‰ํ† ๋ฆฌ์— ์„ค์น˜ํ•˜๊ณ ,

์‹œ์Šคํ…œ์˜ PATH ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์ˆ˜์ •ํ•˜์—ฌ ์„œ๋กœ ์ „ํ™˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

 

์ด ๊ธฐ๋Šฅ์€ ๋‹ค๋ฅธ ๋ฒ„์ „์˜ Node.js๊ฐ€ ํ•„์š”ํ•œ ํ”„๋กœ์ ํŠธ์—์„œ ์ž‘์—…ํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ๋ฒ„์ „์˜ Node.js์— ๋Œ€ํ•ด ์ฝ”๋“œ๋ฅผ ํ…Œ์ŠคํŠธํ•˜๋ ค๋Š” ๊ฒฝ์šฐ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

ํŠนํžˆ, ์ €๋Š” ๋ธ”๋ก์ฒด์ธ ๊ฐœ๋ฐœํ• ๋•Œ ๋งŽ์ด ์œ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. 

์„ค์น˜ํ•˜๊ธฐ (window)

1. https://github.com/coreybutler/nvm-windows/releases ์ ‘์† ํ›„ nvm-setup.zip ํŒŒ์ผ์„ ๋‹ค์šด๋ฐ›์Šต๋‹ˆ๋‹ค. 

2. zip ํŒŒ์ผ์„ ํ’€๊ณ  install ํ•œ๋’ค, cmd ์ฐฝ์„ ์—ด์–ด nvm version ๋ช…๋ น์–ด๋กœ ๋ฒ„์ „์„ ํ™•์ธํ•˜์„ธ์š”.

 

๋งŒ์•ฝ, ์„ค์น˜๊ฐ€ ์ œ๋Œ€๋กœ ์•ˆ๋œ ๊ฒฝ์šฐ๋Š” ์ œ ๊ฒฝ์šฐ์—๋Š” window ์—์„œ ์‚ฌ์šฉ์ž ์ด๋ฆ„์˜ ํด๋”๊ฐ€ ํ•œ๊ธ€๋„ ๋˜์–ด์žˆ๊ฑฐ๋‚˜, ํŠน์ˆ˜๋ฌธ์ž์ธ ๊ฒฝ์šฐ์ž…๋‹ˆ๋‹ค. ์ด๋•Œ๋Š” ๋งค์šฐ ๊ณจ์น˜๊ฐ€ ์•„ํ”•๋‹ˆ๋‹ค. ๐Ÿ˜” ์ €๋Š” ๊ฒฐ๊ตญ ๋‹ค์‹œ ๋ฐ€๊ณ  ์œ ์ €์ด๋ฆ„์„ ์˜๋ฌธ์œผ๋กœ ๋ฐ”๊พผ๋’ค ์žฌ์„ค์น˜ํ•˜๋‹ˆ ์ž˜ ๋ฌ์Šต๋‹ˆ๋‹ค.

 

๋˜ํ•œ nvm ๋ช…๋ น์–ด๋ฅผ ๋ง‰์ƒ ์‚ฌ์šฉํ• ๋•Œ์—๋Š” ๊ด€๋ฆฌ์ž๊ถŒํ•œ์œผ๋กœ ์‹คํ–‰ํ•ด์•ผ ๋ช…๋ น์–ด๊ฐ€ ๋จน์—ˆ์Šต๋‹ˆ๋‹ค. 

์ž์ฃผ์‚ฌ์šฉํ•˜๊ฒŒ๋˜๋Š” ๋ช…๋ น์–ด

1. nvm install <version>  : node์˜ ํŠน์ • ๋ฒ„์ „์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

2. nvm uninstall <version>  : node์˜ ํŠน์ • ๋ฒ„์ „์„ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

3. nvm use <version> : node์˜ ํŠน์ • ๋ฒ„์ „์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

4. nvm ls : ์‹œ์Šคํ…œ์— ์„ค์น˜๋œ ๋ชจ๋“  node๋ฒ„์ „์˜ ๋ชฉ๋ก์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

5. nvm current : ํ˜„์žฌ ์‚ฌ์šฉ์ค‘์ธ node ๋ฒ„์ „์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

 

์‚ฌ์šฉ์˜ˆ์‹œ

C:\WINDOWS\system32>nvm ls  // ๋ชฉ๋กํ™•์ธ

    18.3.0
    16.15.1
    15.14.0
  * 14.17.3 (Currently using 64-bit executable)
    10.15.3
    10.5.0
    8.10.0

C:\WINDOWS\system32>nvm install 16.18.0  // node 16.18.0 ๋ฒ„์ „ ์„ค์น˜
Downloading node.js version 16.18.0 (64-bit)...
Extracting...
Complete


Installation complete. If you want to use this version, type

nvm use 16.18.0

C:\WINDOWS\system32>nvm ls // ๋‹ค์‹œ ๋ชฉ๋กํ™•์ธ

    18.3.0
    16.18.0  // <- ์„ค์น˜๋จ
    16.15.1
    15.14.0
  * 14.17.3 (Currently using 64-bit executable)
    10.15.3
    10.5.0
    8.10.0

C:\WINDOWS\system32>nvm use 16.18.0 // node 16.18.0  ๋ฒ„์ „์„ ์‚ฌ์šฉ
Now using node v16.18.0 (64-bit)

C:\WINDOWS\system32>nvm current // ํ˜„์žฌ ์‚ฌ์šฉ์ค‘์ธ node ๋ฒ„์ „ ํ™•์ธ 
v16.18.0

 

๋ฐ˜์‘ํ˜•