free-tags::

โ€ฆ

How to install(feat.ChatGPT)

Using Homebrew:

1- Install Homebrew: If you havenโ€™t already installed Homebrew, you can do so by executing the following command in your terminal: bashCopy code

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2- Install Node.js and npm: Once Homebrew is installed, you can use it to install Node.js and npm: Copy code brew install node

Using NVM(Node Version Manager):

1_ Install nvm: If you prefer managing multiple Node.js versions or want more control over the installation process, you can use nvm. First, install nvm by running: bashCopy code

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

2_ Close and Reopen Terminal: After installing nvm, close and reopen your terminal to start using it.

3_ Install Node.js and npm: Now, you can use nvm to install the latest version of Node.js and npm: Copy code nvm install node This command installs the latest LTS (Long Term Support) version of Node.js, which includes npm.

Verifying Installation:

After installation, you can verify that Node.js and npm are installed correctly by running the following commands:

Copy code

node -v npm -v

These commands should output the versions of Node.js and npm installed on your system, respectively.

By following one of these methods, you should be able to install the latest version of Node.js and npm on your macOS system.

๋ฒ„์ „์ด ๋‹ค๋ฅด๊ฒŒ ์กฐํšŒ๋  ๋•Œ

(2024-02-11)

์ด ๋ฌธ์ œ์˜ ํ•ด๊ฒฐ์€ ์ค‘์ง€ ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ์ €๋Š” homebrew์˜ Node.js๋ฅผ ๋ฉ”์ธ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์—ˆ์ง€๋งŒ, NVM์ด ๋ฉ”์ธ์œผ๋กœ ์„ค์ •๋œ ์ƒํ™ฉ์„ ์–ด๋–ป๊ฒŒ ๊ณ ์ณ์•ผํ• ์ง€ ๋ช‡ ์‹œ๊ฐ„ ์งธ ํ•ด๋งธ์Šต๋‹ˆ๋‹ค. Homebrew๋ฅผ ๋ฉ”์ธ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ํ˜„์žฌ๋กœ์จ ์ค‘์š”ํ•œ ์ผ์ด ์•„๋‹ˆ๊ธฐ์—, ๋” ์ด์ƒ์˜ ์‹œ๊ฐ„ ํ• ์• ๋ฅผ ๋ฉˆ์ถฅ๋‹ˆ๋‹ค.

๋ฌธ์ œ ์ƒํ™ฉ

  1. brew install node๋กœ node.js์˜ ์ตœ์‹  ๋ฒ„์ „์„ ์„ค์น˜ํ–ˆ์Œ.
  2. ๊ทธ๋Ÿฐ๋ฐ node -v์œผ๋กœ ๋ฒ„์ „์„ ํ™•์ธํ•˜๋ฉด ๊ตฌ ๋ฒ„์ „์ด ์กฐํšŒ ๋จ
ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• 1
  1. home brew์˜ node ๋ฒ„์ „ ํ™•์ธํ•˜๊ธฐ: brew list --versions node
  2. ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ํ™•์ธํ•˜๊ธฐ
    1. ์‹คํ–‰: echo $PATH
    2. ๊ฒฐ๊ณผ
      /Users/tagg/.nvm/versions/node/v16.20.1/bin:/Users/tagg/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin
      
      ์ฒซ ๋ฒˆ์งธ ์ค„: /Users/tagg/.nvm/versions/node/v16.20.1
  3. brew unlink node && brew link node
  4. ํ„ฐ๋ฏธ๋„ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๊ธฐ
ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• 2

nvm์ด homebrew ๋Œ€์‹  ์‚ฌ์šฉ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. echo $PATH๋กœ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

/Users/tagg/.nvm/versions/node/v16.20.1/bin:/Users/tagg/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin

์ฒซ ๋ฒˆ์งธ ์ค„: /Users/tagg/.nvm/versions/node/v16.20.1

๋ฐฉ๋ฒ•

  1. Homebrew์˜ Node.js๋กœ ๋ฐ”๊พธ๊ธฐ ์‹คํ–‰: nvm use system
  2. ์ดˆ๊ธฐํ™” ํ›„(ํ„ฐ๋ฏธ๋„์„ ์žฌ์‹คํ–‰ ์‹œ)์—๋„ ์„ค์ • ์œ ์ง€ํ•˜๊ธฐ
    1. 1๋ฒˆ ์‹คํ–‰ nvm alias default node
    2. 2๋ฒˆ
      1. Inspect Shell Initialization Files: Open each of the relevant shell initialization files using a text editor (nano, vim, emacs, etc.) and search for any lines related to nvm or Node.js. Even if there are no explicit lines related to Node.js, there might be indirect configurations that affect the behavior.
      2. Check Shell Configuration for All Users: Sometimes, shell configurations might be present in system-wide initialization files (/etc/profile, /etc/bashrc, etc.) that affect all users. Check these files as well if youโ€™re making changes that should apply globally.
    3. 3๋ฒˆ
      1. ์‹คํ–‰: env
      2. node.js ๋˜๋Š” nvm๊ณผ ๊ด€๋ จ๋œ lines ์ฐพ๊ธฐ
        1. ์ €๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฐ๊ณผ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
          MANPATH=/Users/tagg/.nvm/versions/node/v16.20.1/share/man:/opt/homebrew/share/man:: 
          NVM_DIR=/Users/tagg/.nvm 
          NVM_CD_FLAGS=-q 
          NVM_BIN=/Users/tagg/.nvm/versions/node/v16.20.1/bin 
          NVM_INC=/Users/tagg/.nvm/versions/node/v16.20.1/include/node
          
      3. nvm ๊ด€๋ จ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ • ์—†์• ๊ธฐ
        1. ์‹คํ–‰:
          unset NVVM_DIR
          unset NVM_CD_FLAGS 
          unset NVM_BIN 
          unset NVM_INC
          
      4. ๋‹ค์‹œ env๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ํ™•์ธํ–ˆ๋”๋‹ˆ ์•ž์„œ ๋ณด์•˜๋˜ NVM ๊ด€๋ จ lines๊ฐ€ ์‚ฌ๋ผ์กŒ์Šต๋‹ˆ๋‹ค.
Reference

Change default version

NVM
  1. ์„ค์น˜๋œ node.js ๋ฒ„์ „ ํ™•์ธํ•˜๊ธฐ run: nvm ls
  2. ํŠน์ • ๋ฒ„์ „ ์‚ฌ์šฉ ์„ค์ •ํ•˜๊ธฐ run: nvm use <version>
  3. ์ ์šฉ๋๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ run: node -v
  4. ์ƒˆ๋กœ์šด shell์—์„œ๋„ ์„ค์ • ์œ ์ง€ํ•˜๊ธฐ run: nvm alias default <version>