Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.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 为什么不是';t';捆扎机/设置';包括我档案中的宝石吗?_Ruby_Gem_Bundler - Fatal编程技术网

Ruby 为什么不是';t';捆扎机/设置';包括我档案中的宝石吗?

Ruby 为什么不是';t';捆扎机/设置';包括我档案中的宝石吗?,ruby,gem,bundler,Ruby,Gem,Bundler,我想使用bundler/setup来包含我列出的所有宝石,但我没有 成功。在go.rb中我有 require 'rubygems' ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', __FILE__)

我想使用
bundler/setup
来包含我列出的所有宝石,但我没有 成功。在
go.rb中
我有

require 'rubygems'                                                                                                
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', __FILE__)                                                   
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
它没有像我想的那样需要
httparty

$ bundle exec ruby go.rb                                                                                          
go.rb:5:in `<main>': uninitialized constant HTTParty (NameError)  
$bundle exec ruby go.rb
go.rb:5:in`:未初始化的常量HttpParty(NameError)
我做错了什么



我已经为这个问题创建了一个小项目

据我所知,
'bundler/setup'
它只管理require路径(删除默认内容并添加在
Gemfile.lock
中定义的gem路径)。如果您不需要有问题的库,它们的内容将不可用。

@troudine您可以执行
Bundler。require(:default)
require'Bundler/setup'
之后需要默认组中的所有gem(您还可以指定其他组)。有关更多信息,请参阅