LoadError:无法加载此类文件 - bundler / setup

时间:2015-09-19 16:51:32

标签: ruby-on-rails ruby macos ruby-on-rails-4 rack-pow

我们正在升级到最新的ruby版本(2.2.3)和最新的rails版本(4.2.4),我们无法通过此错误:

LoadError: cannot load such file -- bundler/setup
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
~/Documents/remsis/config/boot.rb:6:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
~/Documents/remsis/config/application.rb:1:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
~/Documents/remsis/config/environment.rb:2:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
~/Documents/remsis/config.ru:3:in `block in <main>'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/builder.rb:4:in `instance_eval'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/builder.rb:4:in `initialize'
~/Documents/remsis/config.ru:1:in `new'
~/Documents/remsis/config.ru:1:in `<main>'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:51:in `eval'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:51:in `load_config'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:42:in `initialize'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:12:in `new'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:12:in `run'
~/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/bin/nack_worker:4:in `<main>'

2 个答案:

答案 0 :(得分:4)

使用RVM创建Gemset

rvm use 2.2.3@yourproject --create

之后安装bundler gem

gem install bundler

最后一步是进行捆绑安装

bundle install

答案 1 :(得分:0)

如果您正在使用/升级到捆绑器2,请检查此文档:

https://bundler.io/guides/bundler_2_upgrade.html

基本上,根据我的经验,您需要使用RubyGems v2.5.0或更高版本,否则,如果您拥有cannot load such file -- bundler/setup,则会看到require 'bundler/setup'。如果您需要升级红宝石,可以通过以下方式完成:

gem update --system

希望有帮助。谢谢