在 ruby on rails 中启动服务器时出错 [英] Error while starting server in ruby on rails
问题描述
我是 ruby on rails 的新手,在这里我尝试在 64 位 Windows 7 上安装 ruby on rails.
I am newbie to ruby on rails, here i am trying to install ruby on rails on 64 bit windows 7.
在运行命令 rails new app_name
后,我做了 cd app_name
,然后是 rails server
.but 然后在命令中出现以下错误提示.
after running the command rails new app_name
, i did cd app_name
, and then rails server
.but then am getting below error in command prompt.
我该如何解决这个错误?
how can i solve this error?
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,我会得到
If i run bundle install, i am getting
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.
推荐答案
这里你可以试试这个解决方案:
Here you can try this solution :
- 安装 rubyinstaller-1.9.3(我确实尝试过最新版本,但遇到了一些问题,请先尝试使用此安装程序 - 下载 这里 )
- 安装 DevKit(下载 此处) - 查找
用于 Ruby 1.8.7 和1.9.3:
在我们安装 ruby-1.9.3 时下载页面中的文本.- 您可以按照this安装devKit或强>
- 请遵循以下步骤:
- 下载后,运行它以将其解压缩到某处(永久).然后 cd 到它,运行
ruby dk.rb init
和ruby dk.rb
install 将它绑定到路径中的 ruby 安装.
- 下载后,运行它以将其解压缩到某处(永久).然后 cd 到它,运行
- install rubyinstaller-1.9.3(i did try with latest version, but having some problem, just try using this installer first - download Here )
- install DevKit(download Here) - Find the
For use with Ruby 1.8.7 and 1.9.3:
text inside those download page as we install ruby-1.9.3.- You can follow this for devKit installation or
- follow this:
- After download, run it to extract it somewhere (permanent). Then cd to it, run
ruby dk.rb init
andruby dk.rb
install to bind it to ruby installations in your path.
- After download, run it to extract it somewhere (permanent). Then cd to it, run
- 下载AddTrustExternalCARoot-2048.pem,放在ruby安装文件夹里面,通常是这样的路径
C:\Ruby193\lib\ruby\site_ruby\1.9.1\rubygems\ssl_certs
.
- Download AddTrustExternalCARoot-2048.pem, and put inside ruby installation folder, usually something like this path
C:\Ruby193\lib\ruby\site_ruby\1.9.1\rubygems\ssl_certs
.
我第一次在 Windows 平台上安装时也遇到了困难,希望能有所帮助.请注意,如果您使用的不是 rails(sqlite3) 使用的默认数据库,如 mysql、postgresql 等
,那么您需要安装正确的 gem 才能正常工作.只需运行 gem install theRightGemForDatabase
.
I'm also having dificult time when first install on windows platform, hope this help. Please note that, if you are using other than default database using by rails(sqlite3) like mysql, postgresql, etc
, then you need to install the right gem for that to work. just run gem install theRightGemForDatabase
.
这篇关于在 ruby on rails 中启动服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!