简体   繁体   中英

Bundler using different version of ruby

I have installed ruby without using rvm. the paths and version for ruby are as follows:

在此处输入图片说明

But when i run bundle install, a fatal error occurs. It seems to use ruby version ruby1.9.1 from /usr/local/lib/ruby1.9.1 instead of usr/local/bin/ruby . Following is the snapshot:

在此处输入图片说明

How to make bundle install use ruby 1.9.3p0 instead of 1.9.1?? Help!

Run rvm use ruby 1.9.3

You have to specify ruby version in gemfile

ruby '1.9.3'

Then bundler will automatically detect the ruby version

Its not using the wrong version of ruby. Its just trying to install gems to that directory. The real reason you're having problems is because your user doesn't have permission (you can be sure by typing whereis ruby ). Even if running command with sudo worked you would still find yourself having many problems in the future. The reason these issues never occur with RVM is because RVM automatically changes the gem environment variables for your user. For starters type gem env into your console. This will give you very important details about where rubygem searches for executables and paths.

Under the GEM PATH section I see:

  • GEM PATHS:
    • /Users/mike/.rvm/gems/ruby-1.9.3-p194
    • /Users/mike/.rvm/gems/ruby-1.9.3-p194@global

whereas it appears that your ruby installation is looking in /usr/local/lib, which is probably write protected. If you don't want to install RVM then the true fix is to create a directory in your user's root to install gems to. Follow the first step from this guide to change your gem path.

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