我克隆了一个存储库并尝试运行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>'
我的红宝石版本是:
ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-darwin13.3.0]
我的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/
我在Stack Overflow上读到这是一个路径错误,但是,我不熟悉,无法确定要跟踪或更改的内容以使其工作。我在寻找,但我觉得我需要一些方向。
答案 0 :(得分:76)
你可能遗失了bundler
个宝石。
要使其运行(第一个命令可能需要使用sudo
执行,具体取决于您的环境):
[sudo] gem install bundler
bundle install
答案 1 :(得分:1)
在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`
如果是这种情况,请删除您的应用程序根目录中的bundle目录。 之后,运行以下命令:
[sudo] gem install bundler
bundle install
它为我解决了问题