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. I've got Rails 3.0 installed and 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. 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.
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?
Note: I have mysql installed locally (/usr/local/mysql/bin/mysql) and it is running. I also have MAMP installed but it is not running (I only use it for PHP applications). 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...
/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
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. You were trying to execute the rails server command in the Sites folder (thats where the video leaves you) which is impossible. Make sure you cd back to simple_cms and do 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
精彩评论