在 Windows 10 上的导轨上安装 ruby​​ 时出错 [英] Error installing ruby on rails on windows 10

查看:31
本文介绍了在 Windows 10 上的导轨上安装 ruby​​ 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按照此视频的相同说明在 Windows 10 的导轨上安装 ruby​​:https://www.youtube.com/watch?v=G-B_KUFNkQQ

当它完成 ruby​​ 的安装时,我返回到控制台并且在 gem install rails 之后,我得到这个错误:

C:\Users\Usuario>gem install rails --no-document暂时增强 MSYS/MINGW 的 PATH...构建原生扩展.这可能需要一段时间...错误:安装导轨时出错:错误:无法构建 gem 本机扩展.当前目录:C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mimemagic-0.3.9/ext/mimemagicC:/Ruby27-x64/bin/ruby.exe -IC:/Ruby27-x64/lib/ruby/2.7.0/rubygems -rrubygems C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/rake-13.0.1/exe/rake RUBYARCHDIR\=C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mimemagic-0.3.9 RUBYLIBDIR\=C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mimemagic-0.3.9耙子中止!在以下位置找不到 MIME 类型数据库:[/usr/local/share/mime/packages/freedesktop.org.xml"、/opt/homebrew/share/mime/packages/freedesktop.org.xml";, "/usr/share/mime/packages/freedesktop.org.xml"]确保您已经为您的发行版安装了 shared-mime-info 包,或者获取一个版本的 freedesktop.org.xml 并将 FREEDESKTOP_MIME_TYPES_PATH 设置为该位置那个文件.任务:TOP =>默认(通过使用 --trace 运行任务查看完整跟踪)耙子失败,退出代码 1Gem 文件将保留安装在 C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mimemagic-0.3.9 中以供检查.结果记录到 C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mimemagic-0.3.9/gem_make.out

我试图解决进行更新和gem install mime-types-data"的问题.但仍然有同样的问题......

Ruby 安装程序是 Ruby+Devkit 2.7.2-1 (x64),我的 ruby​​ 版本是 ruby​​ 2.7.2p137(2020-10-01 修订版 5445e04352)[x64-mingw32]

解决方案

Windows 10 ruby​​ 2.6.2 install rails 6.0.0.rc1

  1. https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/0440063a2e6823a4b1a6fb2f2af8350f/shared-mime-info-2.0.tar.xz
  2. 使用 7Zip 或 WinRAR 解压缩下载的包.
  3. 将其放置在您选择的位置,例如C:\package".
  4. 使用名称设置新的环境变量:FREEDESKTOP_MIME_TYPES_PATH 和浏览到该位置的值,例如C:\shared-mime-info 2.0\data\freedesktop.org.xml.in
  5. 刷新终端或 CMD 例如命令

<块引用>

刷新环境

  1. 最后,gem install rails -v 6.0.0.rc1

I wanted to install ruby on rails for windows 10, following the same instructions of this video: https://www.youtube.com/watch?v=G-B_KUFNkQQ

When it finish the installation of ruby, I return to the console and after gem install rails, I get this error:

C:\Users\Usuario>gem install rails --no-document
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mimemagic-0.3.9/ext/mimemagic
C:/Ruby27-x64/bin/ruby.exe -IC:/Ruby27-x64/lib/ruby/2.7.0/rubygems -rrubygems C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/rake-13.0.1/exe/rake RUBYARCHDIR\=C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mimemagic-0.3.9 RUBYLIBDIR\=C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mimemagic-0.3.9
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", "/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.

Tasks: TOP => default
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mimemagic-0.3.9 for inspection.
Results logged to C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mimemagic-0.3.9/gem_make.out

I tried to solve making an update and "gem install mime-types-data" but stills with the same problem...

The Ruby Installer is Ruby+Devkit 2.7.2-1 (x64) and my ruby version is ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32]

解决方案

Windows 10 ruby 2.6.2 install rails 6.0.0.rc1

  1. Download the shared-mime-info from https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/0440063a2e6823a4b1a6fb2f2af8350f/shared-mime-info-2.0.tar.xz
  2. Extract the downloaded package with 7Zip or WinRAR.
  3. Place it in a location of your choice e.g. "C:\package".
  4. Set a new Environment Variable with a name: FREEDESKTOP_MIME_TYPES_PATH and browse value to the location e.g. C:\shared-mime-info 2.0\data\freedesktop.org.xml.in
  5. Refresh terminal or CMD e.g. Command

refreshenv

  1. And finally, gem install rails -v 6.0.0.rc1

这篇关于在 Windows 10 上的导轨上安装 ruby​​ 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆