free-tags::
โฆ
- open-source, cross-platform Javascript runtime environement
- https://nodejs.org/en
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๋ฅผ ๋ฉ์ธ์ผ๋ก ์ฌ์ฉํ๋ ๊ฒ์ ํ์ฌ๋ก์จ ์ค์ํ ์ผ์ด ์๋๊ธฐ์, ๋ ์ด์์ ์๊ฐ ํ ์ ๋ฅผ ๋ฉ์ถฅ๋๋ค.
๋ฌธ์ ์ํฉ
brew install node
๋ก node.js์ ์ต์ ๋ฒ์ ์ ์ค์นํ์.- ๊ทธ๋ฐ๋ฐ
node -v
์ผ๋ก ๋ฒ์ ์ ํ์ธํ๋ฉด ๊ตฌ ๋ฒ์ ์ด ์กฐํ ๋จ
ํด๊ฒฐ ๋ฐฉ๋ฒ 1
- home brew์ node ๋ฒ์ ํ์ธํ๊ธฐ:
brew list --versions node
- ํ๊ฒฝ ๋ณ์ ํ์ธํ๊ธฐ
- ์คํ:
echo $PATH
- ๊ฒฐ๊ณผ
์ฒซ ๋ฒ์งธ ์ค: /Users/tagg/.nvm/versions/node/v16.20.1/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
- ์คํ:
brew unlink node && brew link node
- ํฐ๋ฏธ๋ ๋ค์ ์์ํ๊ธฐ
ํด๊ฒฐ ๋ฐฉ๋ฒ 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
๋ฐฉ๋ฒ
- Homebrew์ Node.js๋ก ๋ฐ๊พธ๊ธฐ
์คํ:
nvm use system
- ์ด๊ธฐํ ํ(ํฐ๋ฏธ๋์ ์ฌ์คํ ์)์๋ ์ค์ ์ ์งํ๊ธฐ
- 1๋ฒ
์คํ
nvm alias default node
- 2๋ฒ
- 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. - 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.
- Inspect Shell Initialization Files: Open each of the relevant shell initialization files using a text editor (
- 3๋ฒ
- ์คํ:
env
- node.js ๋๋ nvm๊ณผ ๊ด๋ จ๋ lines ์ฐพ๊ธฐ
- ์ ๋ ๋ค์๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ์์์ต๋๋ค.
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
- ์ ๋ ๋ค์๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ์์์ต๋๋ค.
- nvm ๊ด๋ จ ํ๊ฒฝ ๋ณ์ ์ค์ ์์ ๊ธฐ
- ์คํ:
unset NVVM_DIR unset NVM_CD_FLAGS unset NVM_BIN unset NVM_INC
- ์คํ:
- ๋ค์
env
๋ฅผ ์คํํ์ฌ ํ์ธํ๋๋ ์์ ๋ณด์๋ NVM ๊ด๋ จ lines๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
- ์คํ:
- 1๋ฒ
์คํ
Reference
Change default version
NVM
- ์ค์น๋ node.js ๋ฒ์ ํ์ธํ๊ธฐ
run:
nvm ls
- ํน์ ๋ฒ์ ์ฌ์ฉ ์ค์ ํ๊ธฐ
run:
nvm use <version>
- ์ ์ฉ๋๋์ง ํ์ธํ๊ธฐ
run:
node -v
- ์๋ก์ด shell์์๋ ์ค์ ์ ์งํ๊ธฐ
run:
nvm alias default <version>