我是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.
答案 0 :(得分:7)
关注Instructions from the Ruby Installer Developer Kit Wiki:
cd C:\RubyXXX\DevKit
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install
答案 1 :(得分:0)
您在哪里创建应用程序?如果查看命令行,则表明您已进入桌面。您需要将目录切换到项目文件夹以使其处于正确的上下文中。
此外,您需要安装构建工具来安装json本机扩展。
请参阅/遵循其他堆栈溢出答案的说明 - The 'json' native gem requires installed build tools。
答案 2 :(得分:0)
由于错误建议您必须更新PATH以包含构建工具,也称为DevKit
。
如果您已经使用RailsInstaller在计算机上的rails上安装ruby,那么它已经包含在您的rails安装目录中。您现在要做的就是更新PATH以包含它。请参阅DevKit Overview on Github中的说明的第4步。
如果没有按照上述说明安装DevKit
然后开始工作。
答案 3 :(得分:0)