Issue
I have created a new rails application folder, which worked smoothly. Once within such folder, running any kind of rails command like rails s
will prompt me:
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.
I currently have
spring -v
Spring version 2.1.0
I've tried the following, getting the same results. I also tried uninstalling spring and reinstalling.
bundle exec spring binstub --all
* bin/rake: Spring already present
* bin/rails: Spring already present
Solution
Posting this as an answer after trying every other related solutions to finally find this hidden in a comment. Hope it helps someone in the future.
As for the why, the only reason I see on my side is upgrading from ubuntu (pop os) 20.04 to 20.10. Didn't do anything else between my two coding sessions.
I've tried the indications in that post and kept not working. Somehow running
gem pristine --all
solves the issue, but not sure why – Gotey Jan 3 at 14:05
Answered By - Mathieu Champagne
Answer Checked By - David Marino (JavaFixing Volunteer)