为什么捆绑器不安装 JSON gem? [英] Why won't bundler install JSON gem?
问题描述
尝试运行 cap production deploy
时出现以下错误.
I get the following error when attempting to run cap production deploy
.
DEBUG [dc362284] Bundler::GemNotFound: Could not find json-1.8.1.gem for installation
DEBUG [dc362284] An error occurred while installing json (1.8.1), and Bundler cannot continue.
DEBUG [dc362284] Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
重要的是要注意这个部署是有效的,而不是我升级到 Ruby 2.1.0 以消除编码错误.我在本地升级,效果很好.我运行了 rvm install 2.1.0
和 rvm use 2.1.0
然后更改了我的 .ruby-version
文件以反映这次 Ruby 升级.
It may be important to note that this deployment was working, than I upgraded to Ruby 2.1.0 to remove an encoding error. I upgraded locally which worked fine. I ran rvm install 2.1.0
and rvm use 2.1.0
then changed my .ruby-version
file to reflect this Ruby upgrade.
bundle install
命令在本地工作,但是当我 ssh 到目标服务器并运行此命令时会产生与上述相同的错误.
The bundle install
command works locally, but produces the same above error when I ssh onto the destination server and run this command.
如果我运行 gem list
我可以在 gem 列表中看到这个.
If I run gem list
I can see this in the list of gems.
...
jquery-rails (3.0.4)
json (1.8.1)
less (2.3.2)
...
如果我尝试推荐的解决方案 gem install json -v '1.8.1'
在本地和目标服务器上,我会得到以下输出:
If I try the recommended solution gem install json -v '1.8.1'
Locally and on the destination server I get the following output:
Building native extensions. This could take a while...
Successfully installed json-1.8.1
Parsing documentation for json-1.8.1
Done installing documentation for json after 0 seconds
1 gem installed
看来 gem 已安装,对吧?为什么会这样?我该如何解决这个问题?任何帮助将不胜感激.
So it appears the gem is installed, right? Why is this happening? How can I solve this? Any help would be greatly appreciated.
推荐答案
因此,经过半天的时间,几乎在发布我的问题后,我立即找到了答案.Bundler 1.5.0 有一个错误,它无法将默认 gem 识别为 在此处引用
So after a half day on this and almost immediately after posting my question I found the answer. Bundler 1.5.0 has a bug where it doesn't recognize default gems as referenced here
解决方案是使用 gem install bundler -v '= 1.5.1'
这篇关于为什么捆绑器不安装 JSON gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!