我有一个rails应用程序,我有点新的rails。Ruby Gemfile与Ruby版本不匹配,但匹配ruby -v输出
我的主要问题是我在生产服务器上,无法运行bundle
。 它给这个错误:
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.7
所以,我曾尝试使用rbenv,但它不是作为SUCESSFUL可以看到下面。
$:/home/deploy/my-app/current$ rbenv global 2.1.7
$:/home/deploy/my-app/current$ bundle
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.7
$:/home/deploy/my-app/current$ ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
使用RVM似乎别人都在用在其他问题的话,但我真的只是想红宝石的一个版本上运行(被指定的一个)
此服务器将成为生产,但目前没有生活。
编辑1:gem install bundler
我试图安装包,而在红宝石2.1.7但这并没有工作。
这里是我做过什么:
$:/home/deploy/my-app/current$ ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
$:/home/deploy/my-app/current$ gem install bundler
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
Parsing documentation for bundler-1.11.2
Installing ri documentation for bundler-1.11.2
Done installing documentation for bundler after 4 seconds
1 gem installed
$:/home/deploy/my-app/current$ bundle
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.7
EDIT 2which bundle
$:/home/deploy/my-app/current$ which bundle
/usr/local/bin/bundle
“哪个包”显示什么?这可能是因为你没有在2.1.7中安装Bundler,但是它的版本是1.9.3(我猜测它是由操作系统提供的Ruby版本),当你运行'bundle'时会发现这个版本。 。您可能只需要在2.1.7中安装gem install bundler。 – matt
'哪个bundle给出:/ usr/local/bin/bundle @matt – Rorschach
你是否在使用Bash作为shell?安装捆绑软件后,尝试运行'hash -r'(或者启动一个新的会话)。你的shell可能已经将路径缓存到了旧版本的'bundle',所以你可能仍然会得到它,而不是新的。 – matt