Mavericks, RBENV, Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1

假装没事ソ 提交于 2019-11-28 18:58:08

WOW, JUST WOW.

All I had to do was gem install bundler and then rbenv rehash. Everything worked.

The original error message pointed me to a problem with RBENV or my Ruby version when in reality it was just falling back on an old version of bundler.

Why wouldn't I have received the more standard this needs bundler version [xxxx]... error instead of telling me my Ruby version is specified incorrectly?

If you're having to use sudo to install gems, then something's likely wrong with your rbenv installation. I'm of the opinion that if you're on OS X and you have to run sudo to install gems or packages, you're doing it wrong (especially if you've got homebrew installed)! You've got two options —

Option A: Alter your .zshrc to be a little more friendly with your $PATH and your rbenv settings. Note here that /usr/local/bin is just being prepended to $PATH, which itself is going to set to a proper default by your system (Mavericks). Make those two lines you posted look like this:

export PATH="/usr/local/bin:$PATH"
eval "$(rbenv init -)"

Then ensure that you close any and all shells and open new ones to load the new settings. Then when you run echo $PATH it should look similar to...

[home path]/.rbenv/shims:[home path]/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Option B: Since I'm more familiar with installing rbenv via git, you may try nuking your homebrew-installed rbenv installation by brew remove rbenv, and follow the directions specified on rbenv's github page (and don't forget to install ruby-build as well). This includes removing any rbenv-specific lines in your .zshrc and setting them to what rbenv recommends.

You can always check the sanity of your rbenv installation by running type rbenv at a command prompt. If all is well, you should at least be getting back "rbenv is a function".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!