Lau*_*son 17 ruby linux macos ruby-on-rails
当我尝试在我的新 Mac 机器上安装 Rails v 6.1.1(仍在 Catalina 上,而不是 Big Sur 上)时,我收到一条错误消息,我找不到解决方案
我已经安装了 rbenv 和 Homebrew,并且已经更新到最新版本的 Ruby (3.0.0)。当我推出时,which ruby我得到:/usr/local/opt/ruby/bin/ruby
这是我运行时在终端中看到的错误代码gem install rails -v 6.1.1(sudo安装时出现相同错误):
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic
/usr/local/opt/ruby/bin/ruby -I/usr/local/lib/ruby/site_ruby/3.0.0 -rrubygems /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/gems/3.0.0/gems/rake-13.0.3/exe/rake RUBYARCHDIR\=/usr/local/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.10 RUBYLIBDIR\=/usr/local/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.10
rake aborted!
Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/opt/local/share/mime/packages/freedesktop.org.xml", "/usr/share/mime/packages/freedesktop.org.xml"]
Ensure you have either installed the shared-mime-info package for your distribution, or
obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location of that file.
This gem might be installed as a dependency of some bigger package, such as rails, activestorage, axlsx or cucumber. While most of these packages use the functionality of this gem, some gems have included this gem by accident. Set USE_FREEDESKTOP_PLACEHOLDER=true if you are certain that you do not need this gem, and wish to skip the inclusion of freedesktop.org.xml.
The FREEDESKTOP_PLACEHOLDER option is meant as a transitional feature, and will be deprecated in the next release.
/usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:15:in `locate_mime_database'
/usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:39:in `block in <top (required)>'
Tasks: TOP => default
(See full trace by running task with --trace)
rake failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10 for inspection.
Results logged to /usr/local/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.10/gem_make.out
Run Code Online (Sandbox Code Playgroud)
C-R*_*RAD 35
如果你想brew为你安装这个并且你有brew一段时间没有更新,我建议你运行:
HOMEBREW_NO_AUTO_UPDATE=1 brew install shared-mime-info
Run Code Online (Sandbox Code Playgroud)
我刚跑
brew install shared-mime-info
Run Code Online (Sandbox Code Playgroud)
它更新了一堆我不想要的软件包并破坏了我的 ruby 安装。
我也喜欢 spickermann 的解决方案。这似乎是包维护者希望你做的。
只需安装shared-mime-info在您的计算机上。来自mimemagic gem的文档
您将需要 Freedesktop.org shared-mime-info 数据库的副本才能使用。如果您使用的是 Linux,它可能可以通过您的包管理器获得,并且可能会在安装 gem 时查找它的位置。
macOS 用户可以通过 Homebrew 安装数据库
brew install shared-mime-info。如果您无法使用软件包管理器,您可以通过从 Debian 软件包中提取所需文件来获取它的副本。此过程也适用于 Windows 计算机。[...]
您可能需要考虑安装Rails6.1.3.1(而不是6.1.1在您的命令中)。发布该版本是为了准确mimemagic解决您面临的问题——就在几个小时前。
| 归档时间: |
|
| 查看次数: |
8470 次 |
| 最近记录: |