Node - MacOS
- 1 Install Node
- 1.1 Option1. Homebrew로 설치
- 1.2 Option 2. 공식 홈페이지에서 설치
- 1.2.1 Node LTS download
- 1.2.1.1 Node LTS Install
- 1.2.1 Node LTS download
- 1.3 Node 설치 확인
- 2 노드 다중 버전 설치(Multiple Version control for Nodejs)
- 2.1 NVM Install
- 2.1.1 Create profile
- 2.1.1.1 Create .zshrc file
- 2.1.1.2 If use .bash_profile
- 2.1.2 NVM download
- 2.1.2.1 Option 1. With cURL:
- 2.1.2.2 Option 2. Or with Wget:
- 2.1.3 nvm 설치 확인
- 2.1.1 Create profile
- 2.2 nvm을 활용한 Nodejs 설치(Install Multiple version of Node.js)
- 2.1 NVM Install
Install Node
Option1. Homebrew로 설치
LTS: brew install node
세부 버전 선택시: brew install node@14
Option 2. 공식 홈페이지에서 설치
Node LTS download
macOS Installer 클릭
Node LTS Install
설치 파일 클릭 → Continue
Continue
Install
설치 완료
Node 설치 확인
node 설치 확인
node -v
npm 설치 확인
npm -v
노드 다중 버전 설치(Multiple Version control for Nodejs)
NVM Install
nvm stands for Node Version Manager. it helps you manage and switch between different Node versions with ease.
Create profile
Create .zshrc file
Since macOS 10.15, the default shell is zsh
and nvm will look for .zshrc
to update, none is installed by default. Create and run the install script:
touch ~/.zshrc
If use .bash_profile
If you use bash
, the previous default shell, run touch ~/.bash_profile
to create the necessary profile file if it does not exist.
NVM download
You can install nvm using cURL or Wget. On your terminal, run the following:
Option 1. With cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash
Option 2. Or with Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash
We can then run these 3 lines in the terminal in order to use NVM right away:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm 설치 확인
nvm --version
nvm을 활용한 Nodejs 설치(Install Multiple version of Node.js)
LTS
you can install the most recent LTS release, using:
nvm install --lts
Latest
If you’re not sure what the latest version is, you can use the node
alias:
nvm install node
specific version
You can install specific versions by running this command followed by the version you want. For example:
Option 1. Install 14.16.1
nvm install 14.16.1
Option 2. Install 14.16.X
nvm will then install Node.js version 13.14.X
, where X
is the highest available version. At the time of writing, thesis 1, so you’ll have the 13.14.0
version installed on your system
nvm install 14.16
노드 버전 변경(Switching Between Versions)
To switch through installed versions, nvm provides the nvm use
command. This works similarly to the install command. So, you need to follow this by a version number or an alias.
Switch to the LTS release version:
nvm use --lts
Switch to the latest Node.js version:
nvm use node
Switch to Node.js version 14.16.1
:
nvm use 14.16.1
노드 default 버전 변경(Set to specific version as a default)
nvm alias default {version}
NVM으로 설치된 노드 리스트 확인(Listing Installed Instances)
At any time you can check which versions you have installed by running:
nvm ls
You can also check what is the current version in use with the command:
nvm current