RVM and Passenger: No such file to load - bundler

2019-07-28 11:12发布

问题:

I've seen other similar errors, but none of the solutions have worked for me:

On Snow Leopard, I'm using RVM with project-based gemsets. I have both Rails 2 and Rails 3 apps. When I use bundler with Rails 2 or with Rails 3, I get:

no such file to load -- bundler

In my Rails 2 apps that don't use bundler, I just get a message that Rails needs to be installed when it is.

My RVM install has a global gemset with REE version of Ruby.

$ rvm list

rvm rubies

=> ree-1.8.7-2011.03 [ x86_64 ]
   ruby-1.8.7-p174 [ x86_64 ]
   ruby-1.9.2-head [ x86_64 ]

$ rvm gemset list

gemsets for ree-1.8.7-2011.03 (found in /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03)
   cm
   duke
=> global

My global gems:

$ gem list

*** LOCAL GEMS ***

bundler (1.0.14)
daemon_controller (0.2.6)
fastthread (1.0.7)
passenger (3.0.7)
rack (1.3.0)
rake (0.9.0)
rdoc (3.6.1)

Passenger lines in Apache config:

LoadModule passenger_module /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@global/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@global/gems/passenger-3.0.7
PassengerRuby /Users/dwayne/.rvm/wrappers/ree-1.8.7-2011.03@global/ruby

RubyGems environment for "duke" project:

- RUBYGEMS VERSION: 1.6.2
- RUBY VERSION: 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0]
- INSTALLATION DIRECTORY: /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@duke
- RUBY EXECUTABLE: /Users/dwayne/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby
- EXECUTABLE DIRECTORY: /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@duke/bin
- RUBYGEMS PLATFORMS:
  - ruby
  - x86-darwin-10
- GEM PATHS:
   - /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@duke
   - /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@global
- GEM CONFIGURATION:
   - :update_sources => true
   - :verbose => true
   - :benchmark => false
   - :backtrace => false
   - :bulk_threshold => 1000
   - "gem" => "--no-ri --no-rdoc"
   - :sources => ["http://rubygems.org/", "http://gemcutter.org/"]
- REMOTE SOURCES:
   - http://rubygems.org/
   - http://gemcutter.org/

.rvmrc for duke:

rvm --create use  "ree@duke" 

'gem list' within duke directory:

$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
arel (2.0.10)
authlogic (2.1.3)
builder (2.1.2)
bundler (1.0.14)
daemon_controller (0.2.6)
fastthread (1.0.7)
i18n (0.5.0)
mysql (2.8.1)
passenger (3.0.7)
pdfkit (0.5.0)
rack (1.3.0, 1.0.1)
rails (2.3.5)
rake (0.9.0)
rdoc (3.6.1)
tzinfo (0.3.27)

Last few lines of the backtrace:

0   /Users/dwayne/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb   36  in `gem_original_require'
1   /Users/dwayne/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb   36  in `require'
2   /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@global/gems/passenger-3.0.7/lib/phusion_passenger/utils.rb    325 in `prepare_app_process'
3   /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@global/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails/application_spawner.rb    176 in `initialize_server'
4   /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@global/gems/passenger-3.0.7/lib/phusion_passenger/utils.rb    572 in `report_app_init_status'
5   /Users/dwayne/.rvm/gems/ree-1.8.7-2011.03@global/gems/passenger-3.0.7/lib/phusion_passenger/classic_rails/application_spawner.rb

The same is true of my Rails 3 projects.

Can anyone help with this? It sure seems like a path issue, but I can't figure out the problem.

Thanks.

回答1:

Ah, one last place to look, and I found the problem. Turns out I still had some old virtual host settings for Passenger (using PassengerPreferencePane), and for some apps, I also needed to add the setup_load_paths.rb mentioned in the RVM/Passenger installation documentation.