为Rails 3安装webrick / mogrel或任何其他服务器的问题

时间:2011-05-19 20:03:19

标签: ruby-on-rails terminal mongrel webrick

我尝试了各种安装方法,用于从终端部署WEBrick和mongrel。当我输入rails server命令时,我得到以下内容:

Toran1$ rails server
/Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2.rb:8:in `require': dlopen(/Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2.rb:8:in `<top (required)>'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
    from /Users/Toran1/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:28:in `block in <top (required)>'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我已在本地和根级别安装了gem,并且在发出命令之前我也已导航到应用程序文件夹。任何帮助将不胜感激!

3 个答案:

答案 0 :(得分:0)

如果以正确的方式安装rails,Webrick将自动安装。

试试此链接 Here

如果您不想再次安装rails,请尝试使用gem命令安装服务器

不要忘记在Gemfile中包含gems并运行“bundle install”

答案 1 :(得分:0)

如果您正在使用Rails&lt; 3.1你需要使用版本〜&gt; 0.2.7的mysql2 gem

签出文档并搜索活动记录:https://github.com/brianmario/mysql2

我不确定这是否有助于直接解决此问题,但它可能会解决您可能遇到的其他问题。

答案 2 :(得分:0)

只需更新您的捆绑包,可能任何一个较旧的宝石与最新宝石冲突,这种类型的问题就会出现。

gem install bundler

然后bundler install

如果再次发现错误,请删除GEM.lock文件,然后运行

bundler install

这可能会解决问题。