Rails - Can't run rails server with spring gem

When I could run the rails project yesterday on local.
But today I can’t run the project with the below issues.
I haven’t done anything.
I am using Spring 2.1.0*

 $ rails s
    => Booting Puma
    => Rails 5.2.4.1 application starting in development 
    => Run `rails server -h` for more startup options
    Exiting
    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:
    
    /Users/admin/.rvm/gems/ruby-2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
    /Users/admin/.rvm/gems/ruby-2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
    /Users/admin/.rvm/gems/ruby-2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:285:in `block in load'
    /Users/admin/.rvm/gems/ruby-2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in `load_dependency'
    /Users/admin/.rvm/gems/ruby-2.5.0/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:285:in `load'
    /Users/admin/.rvm/gems/ruby-2.5.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    /Users/admin/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'
    /Users/admin/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'
    /work/halfhelix/floravere/heroku_floravere_dev/bin/spring:15:in `<top (required)>'
    bin/rails:3:in `load'
    bin/rails:3:in `<main>'

I know this issue is a commonly known issue.

I have researched to fix issues but I couldn’t fix it.

Anyone had this issue before?

  • run bin/spring binstub --remove --all
  • remove the gem from Gemfile and run bundle install .
  • add the `gem “spring” in Gemfile
  • run bundle install
  • run bundle exec spring binstub --all
  • following doc.
  • Now all should be fine.

@arcangel8801, thank you for your reply.

I have tried all steps but it didn’t help me.

@arcangel8801, this issue was a code issue.
I fixed it and wrote the details here.

The way to fix

1 Like

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs