Hello_app won't launch server


#1

Edit: Rails version was too recent

I’m taking Hartl’s Ruby on Rails tutorial, and I’ve come across an issue with the hello_app tutorial (book section 1.3). When I use the standard rails autogenerated gemfile, I’m able to launch the rails server. When I copy and paste the tutorial’s gemfile, I get a spring constant already initialized error. Following the error message instructions (bundle exec spring binstub --all) hasn’t done anything. I also removed the binstubs, installed bundle without spring in the gemfile, added spring to the gemfile, installed bundle again, and ran the snippet above, again. That also didn’t work. Neither did bundle update. I’ve gone to discord and stackoverflow to no avail.

$ rails server
You've tried to invoke Spring when it's already loaded 
(i.e. the Spring constant is defined).

This is probably because you generated binstubs with Spring 1.0, 
and you now have a Spring version > 1.0 on your system. To solve this, 
upgrade your bundle to the latest Spring version and then 
run `bundle exec spring binstub --all` to regenerate your binstubs. 
This is a one-time step necessary to upgrade from 1.0 to 1.1.

Here's the backtrace:

/home/lucas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/home/lucas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/home/lucas/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/home/lucas/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/home/lucas/odin/webdev101/frameworks/environment/hello_app/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

#2

Try spring stop and then try it again.


#3

Unfortunately, I’ve tried that already.


#4

You could try some of the solutions here


#5

Thanks, but I found that I had Rails 6 installed when the TOP tutorial was in rails 5, and that was the issue.