rbenv
使用或在 M1 MacBook 上安装 Ruby 3.0.x 可以正常工作asdf
。但 2.7.x 和 2.6.x 等旧版本存在各种问题。如何在不homebrew
同时安装 x86 和 ARM 版本的情况下修复它们?
前几天我下载了 asdf,并尝试将其与从 Github 下载的 ruby on Rails 项目一起使用。当我运行时asdf install
,我得到以下响应:
firebase 9.10.0 is already installed
ruby 2.7.2 is already installed
Run Code Online (Sandbox Code Playgroud)
然后我跑rails s
:
No preset version installed for command rails
Please install a version by running one of the following:
asdf install ruby 2.7.2
or add one of the following versions in your config file at
/Users/******/Desktop/****/.tool-versions
ruby 3.0.1
Run Code Online (Sandbox Code Playgroud)
该项目运行在 ruby 2.7.2 上。
.工具版本:
ruby 2.7.2
node 12.18.3
Run Code Online (Sandbox Code Playgroud)
我使用 homebrew 安装了 asdf,并使用 oh-my-zhs 和 asdf 插件。
编辑:运行
asdf …
Run Code Online (Sandbox Code Playgroud) 在终端中解释,我已经使用asdf安装了一个版本的nodejs,但终端只能看到另一个版本:
> asdf list
nodejs
12.18.3
> nodejs --version
v8.10.0
> asdf global nodejs 12.18.3
> nodejs --version
v8.10.0
Run Code Online (Sandbox Code Playgroud)
将以下内容添加到 .zshrc 的顶部
. $HOME/.asdf/asdf.sh
export PATH=$HOME/.asdf/asdf.sh:$PATH
Run Code Online (Sandbox Code Playgroud)
已重新加载.zshrc
> source ~/.zshrc
Run Code Online (Sandbox Code Playgroud)
没有将本地版本设置为 8.10.0 的本地文件。
我如何才能nodejs --version
获得 asdf 认可的全球版本?
rails s
在/.ruby-version
和中更新了我的 Ruby 版本后,我试图在我的 Rails 3.2.13 应用程序中运行我的 Rails 服务器 ( ) /.tools-versions
,但收到以下消息:
asdf: No version set for command rails
you might want to add one of the following in your .tool-versions file:
ruby 2.2.4
Run Code Online (Sandbox Code Playgroud)
但是,我已将两个版本文件中的 ruby 更新为 2.3.0,并在两者中都有体现。当我输入asdf which ruby
ruby 版本也是 2.3.0。
我想帮助理解为什么rails s
会提示这个 asdf 消息,以及我在如何修复它以便我可以运行 rails 服务器方面缺少什么。
我最近转向 asdf 来管理运行时(特别是 Node、Ruby 和 Python)。但是,我通过 Homebrew 安装了很多软件包,这些软件包依赖于 Homebrew 本身安装的这些运行时之一的版本。我想删除这些并仅通过 asdf 管理运行时。
如何让 Homebrew 使用 asdf 管理的运行时?
不幸的是,Visual Studio Code 找不到运行时可执行文件node
。
但综合终端知道node:
$ which node
/home/user/.asdf/shims/node
Run Code Online (Sandbox Code Playgroud)
如何node
在不显式添加运行时可执行文件的情况下引入 Visual Studio Code launch.json
?
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
[...]
"runtimeExecutable": "~/.asdf/shims/node" // <- want to avoid this
}
]
}
Run Code Online (Sandbox Code Playgroud) 所以我正在切换到一个使用ruby
. 他们用作asdf
包管理器
I\xe2\x80\x99m 安装 gem 时遇到问题,I\xe2\x80\x99m 使用zsh
并且 I\xe2\x80\x99m 认为路径可能有问题
运行gem install bundler
输出:You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
ruby -v
\n输出:ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
which ruby
\n输出:/usr/bin/ruby
我尝试为 ruby 设置全局版本,asdf global ruby 2.5.3
但这似乎并没有改变版本
这是我的gem environment
:
RubyGems Environment:\n - RUBYGEMS VERSION: 2.5.2.3\n - RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]\n - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0\n - …
Run Code Online (Sandbox Code Playgroud) 我刚刚安装了 BigSur 和 Python 的全新安装(使用 asdf),在安装 pip 软件包时,它们似乎最终出现在:
./.asdf/installs/python/3.9.2/lib/python3.9/site-packages
which flake8
例如,当我输入时,我得到flake8 not found
,但是当我再次安装它时,pip install flake8
我得到以下信息:
> which flake8
flake8 not found
~
> pip install flake8
Requirement already satisfied: flake8 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (3.8.4)
Requirement already satisfied: pycodestyle<2.7.0,>=2.6.0a1 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (2.6.0)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (0.6.1)
Requirement already satisfied: pyflakes<2.3.0,>=2.2.0 in ./.asdf/installs/python/3.9.2/lib/python3.9/site-packages (from flake8) (2.2.0)
Run Code Online (Sandbox Code Playgroud)
我刚刚尝试使用我安装的请求pip install requests
,但在使用时也找不到which
,但我设法在 VSC 中使用该包。
我正在使用 flake8 和 Black,我需要为 VSC 提供它们的路径。我用过 …
我遇到了一个问题,我以前在 osx 上使用 asdf 超过 6 个多月没有遇到过这个问题。我需要安装 Erlang 21.3.7.1,当我安装时,我从控制台收到这个错误输出,老实说我不知道如何解决:
Me@My-MacBook-Pro:~/Code/codebase|master
? asdf install erlang 21.3.7.1
Downloading kerl...
Downloading OTP-21.3.7.1.tar.gz to /Users/Me/.asdf/plugins/erlang/kerl-home/archives
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124 100 124 0 0 523 0 --:--:-- --:--:-- --:--:-- 523
100 51.5M 0 51.5M 0 0 8541k 0 --:--:-- 0:00:06 --:--:-- 9657k
Extracting source code
Building Erlang/OTP 21.3.7.1 (asdf_21.3.7.1), please wait...
DOCUMENTATION INFORMATION (See: /Users/Me/.asdf/plugins/erlang/kerl-home/builds/asdf_21.3.7.1/otp_build_21.3.7.1.log)
* documentation :
* …
Run Code Online (Sandbox Code Playgroud) 有人有使用 zsh 设置 asdf 的丰富经验吗?我通过 git 安装它。它似乎是在终端中输入“asdf”时安装的,会返回 asdf 命令列表,但是,如果我使用“asdf version”或“asdf plugin list-all”等命令之一,它会返回:
Unknown command: 'asdf version'
No plugin named update
我觉得可能是路径的问题。欢迎任何建议。
asdf-vm ×10
ruby ×4
homebrew ×2
apple-m1 ×1
build-tools ×1
dependencies ×1
erlang ×1
macos ×1
node.js ×1
pip ×1
python-3.x ×1
rbenv ×1
runtime ×1
xcode ×1