这就是诀窍:我必须修复这个,而不需要接触Gemfile。我目前正在创建我的工作环境,以便它与生产服务器相匹配,因此,我根本无法修改rails的代码。
我的操作系统: OSX 10.11
Ruby: Ruby2.0.0p643
Rails: 4.0.0
gem是作为gem 'mysql2'的Gemfile。在执行bundle install时没有错误,但是当我尝试rake db:migrate --trace时,这是输出:
拉克流产了!加载gem‘mysql2 2’时出错。/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in
rescue in block (2 levels) in require' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in块(2级)在require中的/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:ineach' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in块中/User/redar/..rvm/gems/ruby2.0.0-p 643/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:ineach' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in需要‘/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:99:inrequire' /Users/redar/redar/config/application.rb:7:in’/each' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in/redar/redar/Rakefile:4:inrequire' /Users/redar/redar/Rakefile:4:in‘/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10’.1.0/lib/rake/rake_module.rb:25:inload' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/rake\_module.rb:25:inload_rakefile‘load_rakefile’/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:165:instandard\_exception\_handling' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:93:inload_中的raw\_load\_rakefile' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:94:in块rakefile‘/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:77:inblock in run' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:165:instandard_exception_handling’/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:75:inrun' /Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/bin/rake:33:in/Users/redar/..rvm/gems/ruby2.0.0-p 643/bin/rake:23:inload' /Users/redar/.rvm/gems/ruby-2.0.0-p643/bin/rake:23:in‘load' /Users/redar/.rvm/gems/ruby-2.0.0-p643/bin/rake:23:ineval' /Users/redar/.rvm/gems/ruby-2.0.0-p643/bin/ruby\_executable\_hooks:15:in’
我不知道该怎么解释。Rakefile有什么问题吗?
另外,这是来自mkmf.log的输出
编辑:这是我的Rakefile的内容,位于myapp/文件夹
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
MyApp::Application.load_tasks发布于 2016-02-08 20:01:50
试一试
bundle exec rake db:migrate这将确保您正在使用Gemfile中列出的Gemfile中列出的Gemfile加载和可用的Gemfile执行"rake :migrate“。如果您在没有"bundle exec“的情况下运行它,则可能只使用可用的系统宝石执行。
https://stackoverflow.com/questions/35278188
复制相似问题