[Rails] Measures taken when I accidentally did bundle install in the production environment in the local environment and got confused
When I was developing an API with Rails for hobby app development, I mistakenly bundle installed local and production for the first time in a while.
It means that I ran bundle install --path vendor / bundle --without test development
locally. .. ..
At that time, I was able to revive it (probably), so I summarized it.
I get a lot of unfamiliar errors and can't do anything like rails s
.
If you execute the above command, you will probably have a bundle directory directly under the application. I'm scared, but please delete it altogether first.
If you execute rails s
etc. in that state, the error content will change, but the gem you were trying to put in the production environment (for example, the gem required for the database in the production environment such as mysql2) is missing! I get angry.
This seems to be a problem caused by the mismatch between the installed Gem and what is written in Gemfile.lock.
So, delete all the contents of Gemfile.lock.
Then, from a version control tool such as github, copy and paste the information in Gemfile.lock before doing the wrong bundle install.
I've fixed myself this way! I've done it. .. .. I tend to be impatient, but it was quite good. If you find any mistakes or dangerous acts, please let us know.