0

I am trying to run bundle exec db:migrate but get stuck with a load error:

rake aborted!
LoadError: cannot load such file -- sinatra/activerecord/rake/activerecord_6

I'm pretty sure this has to be a configuration error as the actuall code is from a bootcamp and has worked under their enviroment.

I have tried tracing the file locations referred to in the rakefile, db migration script, and evniroment.rb to make sure that I havnt moved something important around.

this is the full error when trying to 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)
Siyu
  • 11,187
  • 4
  • 43
  • 55
  • `sinatra-activerecord` needs to be patched for it to work with `activerecord 6.x.x` .https://github.com/janko/sinatra-activerecord/pull/87 needs to be merged, and the gem needs to be published before this error goes away. if you really want to make it work here and now, set rails gem version to below 6.0.0 – pgericson Aug 22 '19 at 14:03

2 Answers2

1

Had this same issue. Apparently not working with activerecord 6, so updated the versioning in gemfile to a prev version.

gem 'activerecord', '~> 5.0', :require => 'active_record'

then run: bundle update activerecord

beckyp
  • 11
  • 1
0

Delete your gemfile.lock and then run bundle install. That should fix the error.I had the same error and this method fixed the problem for me.