我正在尝试运行包exec db:migrate,但由于加载错误而卡住:
rake aborted!
LoadError: cannot load such file -- sinatra/activerecord/rake/activerecord_6
我很确定这一定是配置错误,因为实际的代码来自新兵训练营,并且在他们的环境下可以正常工作。
我尝试跟踪rakefile,db迁移脚本和evniroment.rb中引用的文件位置,以确保我没有移动任何重要内容。
这是尝试run bundle exec db:migrate
rake aborted!
LoadError: cannot load such file -- sinatra/activerecord/rake/activerecord_6
/home/ryan/.rvm/gems/ruby-2.6.3/gems/sinatra-activerecord-2.0.13/lib/sinatra/activerecord/rake.rb:2:in `require'
/home/ryan/.rvm/gems/ruby-2.6.3/gems/sinatra-activerecord-2.0.13/lib/sinatra/activerecord/rake.rb:2:in `<top (required)>'
/home/ryan/projects/finstagram2/finstagram-master/Rakefile:2:in `require'
/home/ryan/projects/finstagram2/finstagram-master/Rakefile:2:in `<top (required)>'
/home/ryan/.rvm/gems/ruby-2.6.3/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/home/ryan/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
/home/ryan/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
(See full trace by running task with --trace)
答案 0 :(得分:1)
发生了同样的问题。显然不能使用activerecord 6,因此将gemfile中的版本更新为以前的版本。
gem 'activerecord', '~> 5.0', :require => 'active_record'
然后运行: 捆绑更新活动记录
答案 1 :(得分:0)
删除您的gemfile.lock,然后运行捆绑安装。那应该可以解决错误。我也遇到了同样的错误,这种方法为我解决了这个问题。