我是ruby on rails的新手,在这里我试图在64位Windows 7上的rails上安装ruby。
运行命令rails new app_name
后,我执行了cd app_name
,然后执行了rails server
。但是在命令提示符下出现以下错误。
我该如何解决这个错误?
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.
如果我运行bundle install,我正在
C:\Users\walnut>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.
答案 0 :(得分:2)
您可以尝试此解决方案:
For use with Ruby 1.8.7 and 1.9.3:
文本。
ruby dk.rb init
和ruby dk.rb
install将它绑定到路径中的ruby安装。gem install rails --no-ri --no-rdoc
rails new yourProject
"An error occurred while installing rake (*any version), and Bundler cannot continue."
之类的错误,请参阅 solution 或按照以下步骤操作:
C:\Ruby193\lib\ruby\site_ruby\1.9.1\rubygems\ssl_certs
。rails new yourProject
(前一个失败)。yourProject
目录,然后运行rails server
。我在Windows平台上首次安装时也有很多时间,希望对此有所帮助。请注意,如果您使用rails(sqlite3)之类的默认数据库(如mysql, postgresql, etc
),那么您需要安装正确的gem才能使用。只需运行gem install theRightGemForDatabase
。