gpt4 book ai didi

ruby-on-rails - Webrick Rails 服务器无法启动?

转载 作者:太空宇宙 更新时间:2023-11-03 16:50:47 25 4
gpt4 key购买 nike

我使用的是 Rails 4.0.0,昨天使用 mysql-connector-c-6.1.3.winx64 成功安装了 mysql2 gem (mysql-0.3.15)。我使用 rails new simple_cms -d mysql 创建了一个名为“simple_cms”的新 Rails 项目,该项目运行正常,然后运行 ​​bundle install 也正常。

当我尝试运行 rails server 时,出现以下错误:

C:\Users\Hans>cd sites

C:\Users\Hans\Sites>cd simple_cms

C:\Users\Hans\Sites\simple_cms>rails server
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in
`requir e': 126: The specified module could not be found. -
C:/Ruby200-x64/lib/ruby/ge
ms/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so
(LoadError)

from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb :8:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler.rb:132:in `require'
from C:/Users/Hans/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

C:\Users\Hans\Sites\simple_cms>

我该怎么办?顺便说一句,它找不到的模块实际上就在那里。

28-Mar-2014 在安装和重新安装所有问题之后,我仍然无法运行 rails server。由于我主要希望通过此安装来学习 Ruby on Rails,因此我安装了 Bitnami Ruby 堆栈,它会自动安装所有内容。这似乎工作正常,我已经让 Ruby、MySQL 和 Apache Web 服务器正常工作。

最佳答案

我在配置关于学习 Ruby on Rails 的 Lynda 类(class)时遇到了类似的问题。我发现了一个似乎对我有用的额外步骤。由于错误是提示 mysql 中缺少数据库,因此我创建了缺少的数据库并解决了问题。

以 root 身份登录 mysql 并提示输入密码:

mysql -u root -p

然后:

SHOW DATABASES;

CREATE DATABASE simple_cms_development;

exit;

关于ruby-on-rails - Webrick Rails 服务器无法启动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22487654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com