带有 rbenv 版本路径文件问题的捆绑器
Bundler with rbenv version pathfile issue
所以我使用 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
所以我注意到当我 运行 gem bundle install
时版本是 1.13.3
。在 运行ning sudo find / -name bundle
之后,我发现了两个包含该版本号的文件位置。
/Users/myusername/.gems/gems/bundler-1.13.3/exe/bundle
/Users/myusername/.gems/gems/bundler-1.13.3/lib/bundler/man/bundle
在尝试 运行 /Users/myusername/.gems/gems/bundler-1.13.3/exe/bundle install
之后,它运行良好。所以我只是在 ~/.bash_profile
中创建了一个别名,它覆盖了不正确的 bundle 命令。
alias bundle=/Users/alexcohen/.gems/gems/bundler-1.13.3/exe/bundle
这个 gem 的唯一副作用(无论好坏)是它在我 运行 bundle install
下载 gem 的位置。
我仍然需要调查为什么会发生这种情况,但我认为我的 mac 终端中的 bundle
命令引用了某种类型的损坏的捆绑器 gem 或我系统中某处的文件。
所以我使用 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
所以我注意到当我 运行 gem bundle install
时版本是 1.13.3
。在 运行ning sudo find / -name bundle
之后,我发现了两个包含该版本号的文件位置。
/Users/myusername/.gems/gems/bundler-1.13.3/exe/bundle
/Users/myusername/.gems/gems/bundler-1.13.3/lib/bundler/man/bundle
在尝试 运行 /Users/myusername/.gems/gems/bundler-1.13.3/exe/bundle install
之后,它运行良好。所以我只是在 ~/.bash_profile
中创建了一个别名,它覆盖了不正确的 bundle 命令。
alias bundle=/Users/alexcohen/.gems/gems/bundler-1.13.3/exe/bundle
这个 gem 的唯一副作用(无论好坏)是它在我 运行 bundle install
下载 gem 的位置。
我仍然需要调查为什么会发生这种情况,但我认为我的 mac 终端中的 bundle
命令引用了某种类型的损坏的捆绑器 gem 或我系统中某处的文件。