# 2024-06-01
Table of Contents
2024-06-01
asdf
tl;dr
基本的には公式や他の記事を参考にすると良い 注意点
PATH
を通す- 現在使っているシェルをちゃんと確認する
install
https://qiita.com/ucan-lab/items/0b854cfaa9d7c8ede106
❯ brew install asdf ❯ asdf --versionv0.14.0 ❯ echo $SHELL/bin/bash
# https://asdf-vm.com/guide/getting-started.html#_3-install-asdf# add path to ~/.bash_profile
❯ asdf install ❯ asdf plugin list all | grep nodejs nodejs https://github.com/asdf-vm/asdf-nodejs.git ❯ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
❯ asdf listnodejs No versions installed
❯ asdf install nodejs latestTrying to update node-build... okDownloading node-v22.2.0-darwin-x64.tar.gz...-> https://nodejs.org/dist/v22.2.0/node-v22.2.0-darwin-x64.tar.gzInstalling node-v22.2.0-darwin-x64...Installed node-v22.2.0-darwin-x64 to /Users/noriyo_tcp/.asdf/installs/nodejs/22.2.0
asdf: Warn: You have configured asdf to preserve downloaded files (with always_keep_download=yes or --keep-download). Butasdf: Warn: the current plugin (nodejs) does not support that. Downloaded files will not be preserved.
❯ asdf listnodejs 22.2.0 ❯ asdf local nodejs latest ❯ cat .tool-versionsnodejs 22.2.0
proto を使っていたのでそちらを消す
# proto で管理されている ❯ node -vv20.10.0
❯ which node/Users/noriyo_tcp/.proto/bin/node
# reshim してもダメ ❯ asdf reshim nodejs ❯ node -vv20.10.0
# .bashrc からも proto への参照を消す# https://moonrepo.dev/docs/proto/install#uninstalling ❯ rm -rf ~/.proto
node が見つからない
❯ node -vzsh: command not found: node
✘ noriyo_tcp@MacBook-Air ~/M/til main ⁝ ✱ ? ❯ asdf reshim nodejs
noriyo_tcp@MacBook-Air ~/M/til main ⁝ ✱ ? ❯ node -vzsh: command not found: node
✘ noriyo_tcp@MacBook-Air ~/M/til main ⁝ ✱ ? ❯ which nodenode not found
一旦アンインストールしてみる
# 怒られた ❯ asdf uninstall nodejs latestNo such version
❯ asdf listnodejs *22.2.0
# version 指定する ❯ asdf uninstall nodejs 22.2.0
❯ asdf listnodejs No versions installed
もう1回入れる
❯ asdf install nodejs latestTrying to update node-build... okDownloading node-v22.2.0-darwin-x64.tar.gz...-> https://nodejs.org/dist/v22.2.0/node-v22.2.0-darwin-x64.tar.gzInstalling node-v22.2.0-darwin-x64...Installed node-v22.2.0-darwin-x64 to /Users/noriyo_tcp/.asdf/installs/nodejs/22.2.0
asdf: Warn: You have configured asdf to preserve downloaded files (with always_keep_download=yes or --keep-download). Butasdf: Warn: the current plugin (nodejs) does not support that. Downloaded files will not be preserved.>>> elapsed time 13s
# .tool-version はもうあるので良いっぽい ❯ asdf listnodejs *22.2.0
# ダメだなあ
plugin, nodejs を入れ直す
❯ asdf plugin remove nodejs
❯ asdf plugin list*
❯ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
❯ asdf listnodejs No versions installed
# nodejs 入れ直しasdf install nodejs latest
rm .tool-versions ❯ asdf listnodejs 22.2.0
PATH を通す
https://asdf-vm.com/guide/getting-started.html#_3-install-asdf
asdf scripts need to be sourced after you have set your $PATH and after you have sourced your framework (oh-my-zsh etc).
$PATH
を通さないといけない asdf使ってみた #Node.js - Qiita
# ずっと bash を使っているもんだと思っていたが違うようだぞ? ❯ echo $0/usr/local/bin/zsh
# これを実行echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc
# PATH を通す# at the top of .zshrc# macOS だと unset だとデフォルトで yes らしいのでコメントアウト# https://asdf-vm.com/manage/configuration.html#asdf-force-prepend
# export ASDF_FORCE_PREPEND=yesexport PATH=$PATH/.asdf/shims/
❯ echo $PATH/Users/noriyo_tcp/.asdf/shims:/usr/local/opt/asdf/libexec/bin:/Users/noriyo_tcp/.rbenv/shims:/Users/noriyo_tcp/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/iTerm.app/Contents/Resources/utilities:/Users/noriyo_tcp/.docker/bin:/Users/noriyo_tcp/bin:/bin/.asdf/shims/:/Users/noriyo_tcp/.docker/bin:/Users/noriyo_tcp/bin:/bin
❯ node -vv22.2.0
Bash & Homebrew (macOS)
https://asdf-vm.com/guide/getting-started.html#_3-install-asdf
echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.sh\"" >> ~/.bash_profileecho -e "\n. \"$(brew --prefix asdf)/etc/bash_completion.d/asdf.bash\"" >> ~/.bash_profile
# at the top of ~/.bashrcexport PATH=$PATH/.asdf/shims/