Ruby-on-rails 捆绑器/设置(LoadError)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26560725/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bundler/setup (LoadError)
提问by Marco Lau
I cloned a repository and tried to run rails s. However, I received the following error:
我克隆了一个存储库并尝试运行rails s. 但是,我收到以下错误:
/Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/me/workspace/bindo/config/boot.rb:7:in `<top (required)>'
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from bin/rails:9:in `<main>'
My ruby version is:
我的红宝石版本是:
ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-darwin13.3.0]
My gem envcommand run from this project directory:
我的gem env命令从此项目目录运行:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23.2
- RUBY VERSION: 1.9.3 (2014-05-14 patchlevel 547) [x86_64-darwin13.3.0]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /Users/me/.rbenv/versions/1.9.3-p547/bin/ruby
- EXECUTABLE DIRECTORY: /usr/lib/ruby/gems/2.0.0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /usr/lib/ruby/gems/2.0.0
- /Users/me/.gem/ruby/1.9.1
- /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I read on Stack Overflow that this is a path error, however, I am not familiar enough to figure out what to trace or change to make this work. I'm looking but I feel I need some direction.
我在 Stack Overflow 上读到这是一个路径错误,但是,我不够熟悉,无法弄清楚要跟踪或更改哪些内容才能使其正常工作。我正在寻找,但我觉得我需要一些指导。
回答by Aleksei Matiushkin
You likely have bundlergem missing.
您可能bundler缺少宝石。
To get it to work run (first command may need be executed with sudo, depending on your environment):
要使其正常运行(可能需要使用 执行第一个命令sudo,具体取决于您的环境):
[sudo] gem install bundler
bundle install
回答by Andrew Ramnikov
On the mac, it is possible that you installed gems to ./vendor/bundlein order to avoid to use SUDO.
You can find it if you run gem install bundler and at the end of the output you see the following:
在 Mac 上,您可能安装了 gems./vendor/bundle以避免使用 SUDO。如果您运行 gem install bundler 并且在输出的末尾您会看到以下内容,则可以找到它:
Using turbolinks-source 5.1.0
Using turbolinks 5.1.0
Using uglifier 4.1.4
Bundle complete! 13 Gemfile dependencies, 68 gems now installed.
Bundled gems are installed into `./vendor/bundle`
If this is the case than in your app root directory delete the bundle directory. After this run the following commands:
如果是这种情况,请在您的应用程序根目录中删除捆绑目录。在此之后运行以下命令:
[sudo] gem install bundler
bundle install
It solved the problem for me
它为我解决了问题

