0

I am on WSL, working on Ruby on Sinatra web application training, when I require the './main' on heroku run console command, I get LoadError and it can't require 'dm-postgres-adapter.

I have been following a tutorial, using WSL, I installed Ruby along with its dependencies, so far all the gems I've installed were successful. But when I push to heroku and when I run the 'heroku run console' command, and I type in 'require "./main"' I get a LoadError, telling me...

joelg@SurfacePro3:~/RubyProgs/SinatraExcercise$ heroku run console
Running console on ⬢ sinatra-project-jg... up, run.2550 (Free)
irb(main):001:0> require './main'
WARNING: If you plan to load any of ActiveSupport's core extensions to Hash, be sure to do so *before* loading Sinatra::Application or Sinatra::Base. If not, you may disregard this warning. LoadError: cannot load such file -- dm-postgres-adapter from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `require' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `load_adapter' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:133:in `adapter_class' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:13:in `new' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core.rb:230:in `setup' from /app/main.rb:21:in `block in ' from /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.4/lib/sinatra/base.rb:1426:in `configure' from /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.4/lib/sinatra/base.rb:1925:in `block (2 levels) in delegate' from /app/main.rb:20:in `' from (irb):1:in `require' from (irb):1 from /app/bin/irb:15:in `' irb(main):002:0>

When I ran it said that dm-postgres-adapter is not required, but it is I have it loaded on my Gemfile.

5
  • What require lines exist in main.rb? What tutorial are you following? Commented Dec 22, 2018 at 23:20
  • require "sinatra" require "sinatra/contrib" if development? require 'sinatra/flash' require "pony" require "slim" require "sass" require "./song" require './sinatra/auth' require 'v8' require 'coffee-script' I'm following the jumpstart sinatra book. Commented Dec 22, 2018 at 23:24
  • That's quite difficult to read so you should move that information into your question. What happens if you add require 'dm-postgres-adapter'? Commented Dec 22, 2018 at 23:31
  • same error, just that this time the error is in the require section. Commented Dec 22, 2018 at 23:45
  • Not sure, I'd suggest going through the guide you're using with a fine toothed comb and make sure you're following every step exactly in order. Commented Dec 23, 2018 at 0:20

1 Answer 1

0

I was getting the same errors. Don't ignore the Warnings from Heroku when you push to heroku.

If you're using Git (which you probably are) you'll need to first remove the .bundle/ folder via the command line:

git rm --cached -r .bundle/

Then you'll need to add a .gitignore file in the main directory with ".bundle/" in the body of the file

Commit it all to git and/or github. Push to Heroku. (no more nasty warning RE the .bundle/ folder)

Then run your heroku run console command and pick up with the Jumpstart tutorial again.

Sign up to request clarification or add additional context in comments.

1 Comment

T_T .....THANK YOU, I'VE BEEN STRUGGLING WITH THAT FOR OVER ALMOST A YEAR NOW, and it worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.