【发布时间】:2017-02-21 17:27:33
【问题描述】:
所以我使用 rbenv 来设置我的 ruby 版本(对于我正在处理的特定项目是 2.1.1)。问题是捆绑程序无法检测到此更改。我什至尝试在我的 gemfile 中设置版本:
source "https://my-proxy-address"
ruby "2.1.1"
gem 'fileutils'
gem 'json'
gem 'chef-api'
但是,这会导致确切的错误消息,如教程末尾的 here 所示:
username@hostname:~/Desktop/working-bundler-env$ rbenv version
2.1.1 (set by /Users/username/.rbenv/version)
username@hostname:~/Desktop/working-bundler-env$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin15.0]
username@hostname:~/Desktop/working-bundler-env$ bundle install
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1
The tutorial 有解决问题的方法(编辑路径文件),但是他们没有说明要更改的文件。我要更改什么文件?
$ rbenv
rbenv 1.0.0
Usage: rbenv <command> [<args>]
Some useful rbenv commands are:
commands List all available rbenv commands
local Set or show the local application-specific Ruby version
global Set or show the global Ruby version
shell Set or show the shell-specific Ruby version
install Install a Ruby version using ruby-build
uninstall Uninstall a specific Ruby version
rehash Rehash rbenv shims (run this after installing executables)
version Show the current Ruby version and its origin
versions List all Ruby versions available to rbenv
which Display the full path to an executable
whence List all Ruby versions that contain the given executable
See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/rbenv/rbenv#readme
$ which bundle
/usr/local/bin/bundle
【问题讨论】:
-
你试过
rbenv rehash吗? -
我试过没有变化
-
您能否显示您的 $PATH 变量值 (
echo $PATH) 以及rbenv命令的输出? -
rbenv rehash没有输出,这是我的 $PATH/Users/$MYUSER/.rbenv/shims:/Users/$MYUSER/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin -
命令只是
rbenv没有“rehash”
标签: ruby bash macos bundler rbenv