简体   繁体   English

Ruby On Rails:尝试启动 WEBrick 时出现错误消息

[英]Ruby On Rails: Error Message When Trying To Start WEBrick

I'm a TOTAL NEWBIE trying to learn Rails from a Lynda.com Ruby on Rails tutorial.我是一个尝试从 Lynda.com Ruby on Rails 教程学习 Rails 的新手。 I've got Rails 3.0 installed and Ruby Germs 1.8.我已经安装了 Rails 3.0 和 Ruby Germs 1.8。 Up to this point in the tutorial, I have created a Rails project and we are just about to access it.到目前为止,我已经创建了一个 Rails 项目,我们即将访问它。 The tutor says that I should be able to type导师说我应该会打字

rails server

in the terminal on a mac to boot up WEBrick which comes installed with Rails.在 Mac 上的终端中启动安装了 Rails 的 WEBrick。

However, when I do it, I got the error message below (which I can't make sense of).但是,当我这样做时,我收到了下面的错误消息(我无法理解)。 **Do you know what I can do to get WEBrick working? **你知道我可以做些什么来让 WEBrick 工作吗?

Note: I have mysql installed locally (/usr/local/mysql/bin/mysql) and it is running.注意:我在本地(/usr/local/mysql/bin/mysql)安装了 mysql 并且它正在运行。 I also have MAMP installed but it is not running (I only use it for PHP applications).我也安装了 MAMP,但它没有运行(我只将它用于 PHP 应用程序)。 I would also like to use mysql and WEBrick so that I can work along with the tutorial, but if there's an alternative solution that you can think of please also let me know...我还想使用 mysql 和 WEBrick 以便我可以使用本教程,但是如果您有其他可以想到的解决方案,也请告诉我...

/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2.rb:8
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:120:in `require'
    from /Users/michaelmitchell/Sites/simple_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6

UPDATE I tried a reinstall of mysql2 like this更新我尝试像这样重新安装mysql2

sudo gem install mysql2 — –with-mysql-configs=/usr/local/mysql/bin/mysql_config

error message错误信息

Building native extensions.  This could take a while...
Successfully installed mysql2-0.3.6
ERROR:  Could not find a valid gem '—' (>= 0) in any repository
ERROR:  Could not find a valid gem '–with-mysql-configs=/usr/local/mysql/bin/mysql_config' (>= 0) in any repository
1 gem installed
Installing ri documentation for mysql2-0.3.6...

Enclosing class/module 'mMysql2' for class Client not known

Enclosing class/module 'mMysql2' for class Result not known
Installing RDoc documentation for mysql2-0.3.6...

Enclosing class/module 'mMysql2' for class Client not known

Enclosing class/module 'mMysql2' for class Result not known

I had the same problem and the comments above doesn't relate to your mistake.我有同样的问题,上面的评论与你的错误无关。 What the video didn't make you do was cd back to simple_cms .视频没有让你做的是cd back to simple_cms You were trying to execute the rails server command in the Sites folder (thats where the video leaves you) which is impossible.您试图在 Sites 文件夹(视频离开您的位置)中执行 rails server 命令,这是不可能的。 Make sure you cd back to simple_cms and do rails server.确保您cd 回到simple_cms并执行rails server。

try this out:试试这个:

cd /Applications/MAMP/Library/lib/mysql/
ln -s  ibmysqlclient.la ibmysqlclient.a
ln -s libmysqlclient_r.la libmysqlclient_r.a
ln -s libndbclient.la libndbclient.a

sudo gem install mysql2 — –with-mysql-configs=/Applications/MAMP/Library/bin/mysql_config

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM