[Ruby] [Programming beginner] How to deal with rails s error in local development environment

1 minute read

Situation

As usual in the terminal, when I tried to start the rails server,

terminal


user@usernoMacBook-Air app name %rails s
Traceback (most recent call last):
5: from bin/rails:3:in `<main>'
4: from bin/rails:3:in `load'
3: from /Users/user/app name bin/spring:10:in `<top (required)>'
2: from /Users/user/app name /bin/spring:10:in `new'
1: from /System/Library/Frameworks/Ruby.framework/Versions/
2.6/usr/lib/ruby/2.6.0/bundler/lockfile_parser.rb:95:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby
/2.6.0/bundler/
lockfile_parser.rb:108:in `warn_for_outdated_bundler_version'
: You must use Bundler 2 or greater with this lockfile.(Bundler::LockfileError)

My server suddenly stopped coming up with the above error.

environment

terminal



 ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin19]

 bundler -v
Bundler version 1.7.4

What you have done

bundler is already installed

terminal


sudo gem update bundler

When you do

terminal


Your Ruby version is 2.6.3, but your Gemfile specified 2.5.3

Will come out. The ruby version of the app I’m developing is 2.5.3 For some reason, the version of ruby in the Mac’s local development environment is 2.6.3. (I may have upgraded without realizing it) Since the version is different, the above was displayed.

We have already created a production environment for deployment on AWS, and the ruby version in the production environment is Since it was 2.5.3, I want to unify the version with 2.5.3,

terminal


rbenv local 2.5.3
(Considering the possibility of developing other apps locally using rails in the future
(By rbenv global, I purposely specified to use 2.5.3 only for this project with local)

terminal


source ~/.bash_profile

The server is now up and running!

from now on

Why local ruby version has gone up I would like to investigate. .. ..