遇到困难但成功使用mysql2 v 0.4.2安装
gem install mysql2 -v '0.4.2' -- --srcdir=/usr/local/mysql/include
我现在在运行bundle exec rails s
时遇到以下错误
`require': cannot load such file -- mysql2/mysql2 (LoadError)
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/mysql2-0.4.2/lib/mysql2.rb:31:in `<top (required)>'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:82:in `require'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:82:in `block (2 levels) in require'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:77:in `each'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:77:in `block in require'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:66:in `each'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:66:in `require'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/bundler-1.15.4/lib/bundler.rb:108:in `require'
from /Users/jmayer/workspace/sekai-property/config/application.rb:8:in `<top (required)>'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/jmayer/.rvm/gems/ruby-2.3.1/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
rails -v
Rails 4.2.5
ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18]
我已经尝试过在堆栈溢出中发现的所有与错误有关的内容,但是没有运气。
我只是在尝试启动开发服务器,创建数据库等。
答案 0 :(得分:0)
由于您使用的是
bundle exec
,因此仅考虑宝石 存在于Gemfile中,因此您需要将其放在此处。
包含
gem mysql2
在您的Gemfile中(位于项目的根目录中)
然后运行
bundle install
然后您可以运行
bundle exec rails s