简体   繁体   中英

Bundler using an older Ruby version

I have Ruby 2.3.0 installed in my system. The output of ruby -v is:

ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

When I try to run Rails using:

bundle exec rails new ~/my-test-app --dev

I get the following error:

Your Ruby version is 2.1.7, but your Gemfile specified 2.3.0

I have both Ruby versions installed. How to make bundle use Ruby 2.3.0 instead of 2.1.7

TL;DR Change the version of Ruby from 2.1 to 2.3 in /usr/local/bin/bundle.

Explanation

To figure out which Ruby bundler is using enter

which bundle

This should print

/usr/local/bin/bundle

Now open the file and change the Ruby version from 2.1 to 2.3

Run gem install bundler should fix this for you.

Then remember rbenv rehash

Reload 'bashrc' file if the problem is still there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM