How to fix “Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5” while server starting

前端 未结 11 1287
面向向阳花
面向向阳花 2020-12-04 15:30

I am getting this error while running server, how do I fix this?

相关标签:
11条回答
  • 2020-12-04 15:59

    Add the following to your Gemfile

    ruby '2.3.0'
    
    0 讨论(0)
  • 2020-12-04 15:59

    I had this problem but I solved it by installing the version of the ruby that is specified in my gem file using the RVM

        rvm install (ruby version)
    

    After the installation, I use the following command to use the the version that you installed.

        rvm --default use (ruby version)
    

    You have to install bundler by using the following command in order to use the latest version

        gem install bundler 
    

    After the above steps, you can now run following command to install the gems specified on the gemfile

        bundle install
    
    0 讨论(0)
  • 2020-12-04 16:01

    Two steps worked for me:

    gem install bundler
    
    bundle install --redownload # Forces a redownload of all gems on the gemfile, assigning them to the new bundler
    
    0 讨论(0)
  • 2020-12-04 16:05

    A problem I had on my Mac using rbenv was that when I first set it up, it loaded a bunch of ruby executables in /usr/local/bin - these executables loaded the system ruby, rather than the current version.

    If you run

    which bundle

    And it shows /usr/local/bin/bundle you may have this issue.

    Search through /usr/local/bin and delete any files that start with #!/user/bin ruby

    Then run

    rbenv rehash

    0 讨论(0)
  • 2020-12-04 16:11

    If you are using rbenv then make sure that you run the "rbenv rehash" command after you set local or global ruby version. It solved the issue for me.

    rbenv rehash
    
    0 讨论(0)
提交回复
热议问题