【问题标题】:How to install ruby on rails如何在rails上安装ruby
【发布时间】:2015-10-25 03:22:31
【问题描述】:

我是 ruby​​ on rails 的新手,我正在尝试在 windows 7 64 位上安装 ruby​​ on rails。我安装了 ruby​​ 安装程序并安装了 rails。我还创建了新的应用程序文件。但是当我启动 Rails 服务器时,它显示以下错误。

我怎样才能摆脱这些错误并开始开发我的 ruby​​ 应用程序?

C:\Users\walnut\Desktop > bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.................
Using rake 10.4.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

C:\Users\walnut\Desktop > rails s
Could not find gem 'mysql2 (>= 0) x64-mingw32' in any of the gem sources listed
in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

C:\Users\walnut\Desktop > gem install mysql2
Fetching: mysql2-0.3.19.gem (100%)
ERROR:  Error installing mysql2:
        The 'mysql2' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

C:\Users\walnut\Desktop > rails s
Could not find gem 'mysql2 (>= 0) x64-mingw32' in any of the gem sources listed
in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

【问题讨论】:

标签: ruby-on-rails ruby


【解决方案1】:

您在哪里创建应用程序?如果你查看你的命令行,你就在你的桌面上。您需要将目录切换到项目文件夹以处于正确的上下文中。

另外,你需要安装构建工具来安装json原生扩展。

请参考/遵循其他堆栈溢出答案中的说明 - The 'json' native gem requires installed build tools

【讨论】:

    【解决方案2】:

    正如错误提示,您必须更新 PATH 以包含构建工具,也称为 DevKit

    如果您使用 RailsInstaller 在您的计算机上安装 ruby​​ on rails,那么它已经包含在您的 rails 安装目录中。您现在要做的就是更新您的 PATH 以包含它。请参阅DevKit Overview on Github 中的第 4 步说明。

    如果不按照上述说明安装DevKit,然后开始工作。

    【讨论】:

      【解决方案3】:

      尝试关注step 以及另外一件事,如果您使用 ruby​​ 安装程序的 x64,请使用 x64 devkit。同样适用于 x86。我正面临这个问题,链接给了它(安装步骤)给你节省了我的时间。希望这有帮助。

      p/s :如果我在 windows 中是正确的,上面的 ruby​​ v2.2 不支持更高的 nokogiri,为了让事情正常工作,请使用 ruby​​ v1.9.3 或 v2.1.6。

      查看此link 是否也支持 nokogiri。

      【讨论】:

        【解决方案4】:

        From here,

        关注Instructions from the Ruby Installer Developer Kit Wiki

        1. rubyinstaller.org 下载 DevKit 文件
        2. 将 DevKit 解压到路径 C:\RubyXXX\DevKit
        3. 运行cd C:\RubyXXX\DevKit
        4. 运行ruby dk.rb init
        5. 运行ruby dk.rb review
        6. 运行ruby dk.rb install

        【讨论】:

        • 完美答案!谢谢
        猜你喜欢
        • 1970-01-01
        • 2018-08-04
        • 2015-09-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-01
        • 2014-06-06
        相关资源
        最近更新 更多