Linux-WSL/Linux-WSL__settings

WSL에 node 설치하기

말하는감자 2022. 4. 15. 11:16

nvm 설치

# cURL 설치
noel  /mnt/d  sudo apt install curl

# nvm 설치
 noel  /mnt/d  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

#   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#                                  Dload  Upload   Total   Spent    Left  Speed
# 100 13527  100 13527    0     0  40020      0 --:--:-- --:--:-- --:--:-- 40020
# => Downloading nvm from git to '/home/noel/.nvm'
# => Cloning into '/home/noel/.nvm'...
# remote: Enumerating objects: 290, done.
# remote: Counting objects: 100% (290/290), done.
# remote: Compressing objects: 100% (257/257), done.
# remote: Total 290 (delta 34), reused 111 (delta 20), pack-reused 0
# Receiving objects: 100% (290/290), 163.37 KiB | 6.81 MiB/s, done.
# Resolving deltas: 100% (34/34), done.
# => Compressing and cleaning up git repository

# => Appending nvm source string to /home/noel/.bashrc
# => Appending bash_completion source string to /home/noel/.bashrc
# => You currently have modules installed globally with `npm`. These will no
# => longer be linked to the active version of Node when you install a new node
# => with `nvm`; and they may (depending on how you construct your `$PATH`)
# => override the binaries of modules installed with `nvm`:

# /usr/lib
# ├── corepack@0.10.0
# => If you wish to uninstall them at a later point (or re-install them under your
# => `nvm` Nodes), you can remove them from the system Node as follows:

#      $ nvm use system
#      $ npm uninstall -g a_module

# => Close and reopen your terminal to start using nvm or run the following to use it now:

# 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 환경 변수 설정

noel  /mnt/d  vim ~/.zshrc

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

# 추가 후에 저장

 noel  /mnt/d  source ~/.zshrc

 # 버전 확인
noel  /mnt/d  nvm --version
0.35.3

현재 설치된 노드 버전 확인

 noel  /mnt/d  nvm install node
# Downloading and installing node v17.9.0...
# Downloading https://nodejs.org/dist/v17.9.0/node-v17.9.0-linux-x64.tar.xz...
# ####################################################################################################### 100.0%
# Computing checksum with sha256sum
# Checksums matched!
# Now using node v17.9.0 (npm v8.5.5)
# Creating default alias: default -> node (-> v17.9.0)

node 설치

# 설치
noel  /mnt/d  nvm install node --lts

# 버전 확인
noel  /mnt/d  nvm ls
# ->      v17.9.0
#          system
# default -> node (-> v17.9.0)
# node -> stable (-> v17.9.0) (default)
# stable -> 17.9 (-> v17.9.0) (default)
# iojs -> N/A (default)
# unstable -> N/A (default)
# nvm_list_aliases:36: no matches found: /home/noel/.nvm/alias/lts/*

'Linux-WSL > Linux-WSL__settings' 카테고리의 다른 글

WSL에 node 설치하기  (0) 2022.04.15
1