Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 我使用MacPorts安装了Capistrano,但capify找不到Capistrano gem_Ruby_Rubygems_Capistrano_Macports - Fatal编程技术网

Ruby 我使用MacPorts安装了Capistrano,但capify找不到Capistrano gem

Ruby 我使用MacPorts安装了Capistrano,但capify找不到Capistrano gem,ruby,rubygems,capistrano,macports,Ruby,Rubygems,Capistrano,Macports,在OS X 10.7.5 I上使用MacPorts安装capistrano,如下所示: [~] > install rb-capistrano 但是,当我运行capify时,会出现以下错误: /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem capistrano (>= 0) (Gem::LoadError) from /opt

在OS X 10.7.5 I上使用MacPorts安装capistrano,如下所示:

[~] > install rb-capistrano
但是,当我运行capify时,会出现以下错误:

/opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem capistrano (>= 0) (Gem::LoadError)
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:214:in `activate'
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:1082:in `gem'
from /opt/local/bin/capify-1.8:18

这显然是capistrano、ruby和gems的MacPorts部署中的一个bug,但在此期间有什么方法可以解决这个问题吗?我只想让Capistrano工作,我根本不关心Ruby on Rails或任何Ruby的东西。

我的解决方法是:手动安装gem,或者使用rvm安装它,完全绕过MacPorts

我选择了选项1:使用“gem”安装Capistrano。当然,这涉及到安装MacPorts gem并修复安装以实际工作:

12:10 ~project ➤ which gem
/usr/bin/gem
12:10 ~project ➤ sudo port install rb-rubygems
12:11 ~project ➤ ln -s /opt/local/libexec/ruby1.8/gem /opt/local/bin/gem
12:11 ~project ➤ sudo gem install capistrano                                         
Successfully installed highline-1.6.19
Successfully installed net-ssh-2.6.7
Successfully installed net-ssh-gateway-1.2.0
Successfully installed capistrano-2.15.4
4 gems installed
Installing ri documentation for highline-1.6.19...
Installing ri documentation for net-ssh-2.6.7...
Installing ri documentation for net-ssh-gateway-1.2.0...
Installing ri documentation for capistrano-2.15.4...
Installing RDoc documentation for highline-1.6.19...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README
Installing RDoc documentation for net-ssh-2.6.7...
Installing RDoc documentation for net-ssh-gateway-1.2.0...
Installing RDoc documentation for capistrano-2.15.4...
12:12 ~project ➤ which capify
/opt/local/bin/capify
12:12 ~project ➤ capify .
[add] making directory './config'
[add] writing './config/deploy.rb'
[add] writing './Capfile'
[done] capified!
如您所见,gem通过安装到/opt/local/(即:MacPorts)目录为我做了“正确的事情”


这一错误已向MacPorts报告为

,我绝对不会使用另一个包管理系统作为安装gems的代理。另外,Ruby 1.8已经过时,将不再接收安全更新;你应该立即升级到Ruby 2.0(或1.9)。遗憾的是,当你
sudo端口安装Ruby时,你会得到1.8。谢谢你的警告!正如@AndrewMarshall所提到的,在使用另一个包管理器时使用gem安装包是一件坏事。在这种情况下,清理混乱就像重新安装MacPorts一样简单(即:rm-rf/opt/local,然后从头开始)。我不会再破坏MacPorts了。