はじめに
Reactの環境構築のためにnode.jsのバージョン管理として、asdfの最新バージョンをインストールしようとしたときに起きたことです。
環境
WSL2
Ubuntu 24.04.3 LTS (Noble Numbat)
問題
asdfをリポジトリから最新バージョンをインストールしました。
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.18.0
その後、各種設定をしたのですが、asdf versionで確認すると、
NOTICE:
You have tried to upgrade to asdf 0.16.0 or newer. Versions 0.16.0 is a
complete rewrite of asdf in Go. This text is being printed by the older
Bash implementation. If you are seeing this you have not migrated to
asdf 0.16.0. Please follow the instructions on the upgrade guide to
migrate to the new version.
Aside from this notice, this older Bash implementation works as it did
in asdf version 0.15.0 and older.
Migration guide: https://asdf-vm.com/guide/upgrading-to-v0-16
asdf website: https://asdf-vm.com
Source code: https://github.com/asdf-vm/asdf
version: v0.15.0-80fffd8
と表示されました。
解決方法
公式ドキュメントによると、バージョン0.16.0以降でインストールの方法が大きく変わっていたみたいです。
公式ドキュメントの「Build from Source」の方法でインストールをしたら、うまくいきました。
ほとんど内容は 手順を記載しておきます。
-
リポジトリをクローンする(クローン済みの方はここは飛ばしてください)
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.18.0 -
Go言語をインストール(バージョンは https://go.dev/dl/ から確認)
wget https://go.dev/dl/go1.25.6.linux-amd64.tar.gz sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.25.6.linux-amd64.tar.gz echo 'export PATH="$PATH:/usr/local/go/bin"' >> ~/.bashrc source ~/.bashrc -
ビルド
cd ~/.asdf && make -
ビルドしたバイナリファイルを
/usr/local/binにコピーsudo cp asdf /usr/local/bin -
~/.bashrcに下記を追加して、保存export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" . <(asdf completion bash) -
~/.bashrcを更新source ~/.bashrc -
バージョンを確認。インストールしたバージョンが表示されていれば、成功
asdf version
おわりに
解決に至るまでに、公式ドキュメントが推奨しているパッケージマネージャーでインストールする方法を試したりしており、小一時間ロスしました。