nvm useの使い方とversion固定の方法

1.nvm useの使い方

# nvm use 16
Now using node v16.14.0 (npm v8.3.1)
# n --stable
16.15.0
[root@hayashi-nodejs-development 48]# n stable
     copying : node/16.15.0
   installed : v16.15.0 to /usr/local/bin/node
      active : v16.14.0 at /root/.nvm/versions/node/v16.14.0/bin/node
# nvm use 16
Now using node v16.14.0 (npm v8.3.1)
# nvm use 16.15
N/A: version "16.15 -> N/A" is not yet installed.

You need to run "nvm install 16.15" to install it before using it.
[root@hayashi-nodejs-development 48]# nvm install 16.15
Downloading and installing node v16.15.0...
Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz...
######################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v16.15.0 (npm v8.5.5)
# nvm use 16.15
Now using node v16.15.0 (npm v8.5.5)
# node -v
v16.15.0
#

2.nvm のdefaultのversion を設定

# nvm alias default v16.15
default -> v16.15 (-> v16.15.0)
#

3.新たに、terminalを開いて確認

# node -v
v16.15.0
# nvm ls
->     v16.15.0
        v17.9.0
        v18.2.0
         system
default -> v16.15 (-> v16.15.0)
#