多语言版本管理器
asdf 通过插件管理多种语言的版本(Node.js、Python、Ruby、Go 等),用 .tool-versions 固定项目版本。它通过 shim 拦截命令,切换版本不需要改 PATH。
asdf plugin add nodejs
asdf plugin add python
asdf install nodejs 20.18.0
asdf install
asdf global nodejs 20.18.0
asdf local nodejs 20.18.0
asdf current
asdf list nodejs
asdf list-all python
asdf reshim nodejs
asdf plugin list
asdf update
asdf reshim;命令找不到时先试这个。.tool-versions 要提交;不同目录的版本可能不同。.tool-versions 会覆盖它。合上页面,先回答,再展开对照。
asdf 靠什么机制切换语言版本,为什么不需修改 PATH?.tool-versions 哪个优先?asdf reshim(如 asdf reshim nodejs),安装新版本后可能需要重建 shim。.tool-versions 会覆盖全局版本;全局版本只是默认值,且 .tool-versions 应提交到仓库。
小程序版
微信扫码,随时查命令