asdfを使ったnodeバージョン管理

anyenv + nodenvの構成を卒業してasdfを使い始めたので備忘録。

コマンド一覧

# インストール可能なプラグイン一覧
$ asdf plugin list all

# nodejsのプラグインをインストール
$ asdf plugin add nodejs

# nodejsのインストール可能なバージョン一覧
$ asdf list all nodejs

# バージョンxx.xx.xxのnodeをインストール
$ asdf install nodejs xx.xx.xx

# バージョンxx.xx.xxのnodeをアンインストール
$ asdf uninstall nodejs xx.xx.xx

# インストール済みnodeバージョン一覧
$ asdf list nodejs

# グローバルに設定
$ asdf global nodejs xx.xx.xx

# ディレクトリに設定
$ asdf local nodejs xx.xx.xx

.node-versionを使いたい場合

~/.asdfrcに以下を追加

legacy_version_file = yes
© 2022 fu9da