Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.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
使用rvm、rubygems和捆扎机_Ruby_Gem_Rvm_Bundler - Fatal编程技术网

使用rvm、rubygems和捆扎机

使用rvm、rubygems和捆扎机,ruby,gem,rvm,bundler,Ruby,Gem,Rvm,Bundler,所以,我过去做过很多Rails编程,现在我只想将Ruby与RVM、Bundler和其他一些gems结合使用。。但在我完成所有设置后,我需要在该项目中使用的gem,并得到以下LoadError: .rvm/../custom_require.rb:36:in `require': cannot load such file -- upnp/ssdp (LoadError) 我正在使用Ruby 1.9.3 我有以下文件: upnp - Gemfile - upnp.rb 而不是在文件中: # G

所以,我过去做过很多Rails编程,现在我只想将Ruby与RVM、Bundler和其他一些gems结合使用。。但在我完成所有设置后,我需要在该项目中使用的gem,并得到以下LoadError:

.rvm/../custom_require.rb:36:in `require': cannot load such file -- upnp/ssdp (LoadError)
我正在使用Ruby 1.9.3

我有以下文件:

upnp
- Gemfile
- upnp.rb
而不是在文件中:

# Gemfile

source "http://rubygems.org"

gem "upnp", git: "https://github.com/turboladen/upnp.git"
和项目主文件:

# upnp.rb
require 'rubygems'
require 'upnp/ssdp'

# Search for all devices (do an M-SEARCH with the ST header set to 'ssdp:all')
all_devices = UPnP::SSDP.search

puts all_devices
现在,在使用gemset设置RVM并捆绑所有内容后,当我运行时:

ruby upnp.rb
我得到上面提到的这个错误

我已经查看了这个gem的Github页面,它有一个
lib
文件夹,其中包含
upnp/ssdp.rb

所以应该很好吧

我真的不知道如何调试这样的东西

有人能解释一下这个问题吗


谢谢

将其包装在对
bundle exec
的调用中。下面是Ruby 1.93p194的示例

$ bundle exec ruby upnp.rb 
D, [2012-11-06 11:05:06 #48555] DEBUG -- : Sent datagram search:
D, [2012-11-06 11:05:06 #48555] DEBUG -- : M-SEARCH * HTTP/1.1

我找不到引用,但是rvm/ruby在查找“git安装”的rubygems时遇到问题。谷歌搜索可能会找到官方答案。

哇,太好了,这似乎奏效了!我确实知道bundle exec,但从未有机会知道何时应该使用它。。我想这是一个很好的时间来了解更多关于这段代码。。谢谢我认为使用最新版本的RVM(head)可以使您不需要使用bundle exec.maybe。我只在RVM 1.16.11。