Skip to content

rails console uses spring in deployment mode #605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
roscom opened this issue Nov 25, 2019 · 6 comments
Closed

rails console uses spring in deployment mode #605

roscom opened this issue Nov 25, 2019 · 6 comments

Comments

@roscom
Copy link

roscom commented Nov 25, 2019

Hi
I have rails 6 app deployed using:

bundle install --deployment --without=development test --quiet --path=... --gemfile=.../build/Gemfile

yet, running the rails console:

rails c
Running via Spring preloader in process 19088
WARNING: Spring is running in production. To fix this make sure the spring gem is only present in `development` and `test` groups in your Gemfile and make sure you always use `bundle install --without development test` in production
Loading production environment (Rails 6.0.1)
irb(main):001:0> 

uses spring, yet spring is defined in the development section of Gemfile, not production.

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'spring-commands-rspec'
  gem 'spring-commands-rubocop'

why is this so?

@roscom roscom changed the title trails console uses spring in deployment mode rails console uses spring in deployment mode Nov 25, 2019
@anoobbava
Copy link
Contributor

Any update on this issue, I am having the similar issue with Rails 6.0.3

@bigos
Copy link

bigos commented Sep 23, 2020

me too

@istickz
Copy link

istickz commented Nov 10, 2020

+1

@rafaelfranca
Copy link
Member

Can you verify if the srping gem is not being installed in production? If it is this seems like a bundler issue, not spring.

@michaelteter
Copy link

In rails 6.1.3.1 this is still a problem.

In my Gemfile, spring and spring-watcher-listen (and listen) are within group :development do block. And I guess since I had done a normal bundle install, the gems were indeed installed. However, they should only be used when Rails is running in development mode.

The first time I fired up RAILS_ENV=production rails console, I saw the warning about spring running. Then after exiting, I confirmed that the spring process was indeed running (for just a couple of minutes, starting exactly when I launched the console).

I gem uninstalled spring and spring-watcher-listen and attempted started the console in production. Rails console simply would not start because of the missing spring gems which it should not be attempting to load given the environment settings in the Gemfile and my command line launch.

$ RAILS_ENV=production rails c
Could not find spring-2.1.1 in any of the sources
Run `bundle install` to install missing gems.

@incorvia
Copy link

incorvia commented Nov 10, 2021

Try updating your bin stubs. I think for me my binstub was old or stale. By updating it added a check to make sure that Spring only loaded in development or testing environments which resolved the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants