我遵循了这个问题中提出的指示和想法:" Why do I get the error “Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2” although I have 2.2.2 installed 2"
当脚本删除"之后的文件夹时,/ User文件夹出现问题时出现同样的错误。"其中包括.rbenv文件夹。
重建铁轨,rbenv等之后。我仍然从rails
得到错误"您的Ruby版本是2.0.0,但您的Gemfile指定为2.2.2"
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/chris/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /Users/chris/.rbenv/versions/2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /Users/chris/.rbenv/versions/2.2.2/bin
- SPEC CACHE DIRECTORY: /Users/chris/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/chris/.rbenv/versions/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/chris/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- /Users/chris/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "-n/usr/local/bin"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/chris/.rbenv/versions/2.2.2/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /Users/chris/.rbenv/shims
- /Users/chris/.rbenv/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/local/mysql/bin
- /Library/PostgreSQL/9.4/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
以下是当前版本:
$ rbenv versions
system
* 2.2.2 (set by /Users/chris/Dropbox/git/frontend.1/.ruby-version)
2.2.3
当前.bash_profile
PS1="\u$ "
alias ll="ls -lahG"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Library/Postg$
export PATH="$HOME/.rbenv/bin:$PATH"
我试过了:
gem install --no-ri --no-rdoc bundler
rbenv rehash
bundle --path=vendor/bundle
但它没有修复或改变错误。
答案 0 :(得分:3)
你的bash init脚本看起来你没有正确安装rbenv。首先,您似乎已经使用Homebrew安装了rbenv。没关系,但你应该在继续之前更新它:
bash: eval: line 21: syntax error: unexpected end of file
如果您使用Homebrew安装,那么您在brew update && brew upgrade rbenv
.bash_profile
但是,您需要将此行添加到# remove this line
export PATH="$HOME/.rbenv/bin:$PATH"
:
.bash_profile
现在,打开一个新的终端窗口,然后
# add this line
eval "$(rbenv init -)"
现在您可以在项目中运行rbenv version #=> 2.2.2
gem i bundler --no-rdoc -no-ri
which bundle #=> ~/.rbenv/shims/bundle
。