问题
So I'm at a loss with this one. My error is:
Missing these required gems: jrails You're running: ruby 1.8.7.72 at /usr/bin/ruby1.8 rubygems 1.3.6 at /home/ryann/.gem/ruby/1.8, /usr/lib/ruby/gems/1.8 Run rake gems:install
to install the missing gems.
I have unpacked jrails in my vendor directory and frozen my local rails environment. Everything works fine on my local machine.
I am using config.gem 'jrails' in my environment.rb file.
My trace is (sorry for the mess):
0 /home/ryann/intercomhq.com/releases/20100709162648/vendor/rails/railties/lib/initializer.rb 336 in `abort'
1 /home/ryann/intercomhq.com/releases/20100709162648/vendor/rails/railties/lib/initializer.rb 336 in `check_gem_dependencies'
2 /home/ryann/intercomhq.com/releases/20100709162648/vendor/rails/railties/lib/initializer.rb 170 in `process'
3 /home/ryann/intercomhq.com/releases/20100709162648/vendor/rails/railties/lib/initializer.rb 113 in `send'
4 /home/ryann/intercomhq.com/releases/20100709162648/vendor/rails/railties/lib/initializer.rb 113 in `run'
5 /home/ryann/intercomhq.com/releases/20100709162648/config/environment.rb 20
6 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
7 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require'
8 /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb 299 in `preload_application'
9 /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb 248 in `initialize_server'
10 /dh/passenger/lib/phusion_passenger/utils.rb 255 in `report_app_init_status'
11 /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb 233 in `initialize_server'
12 /dh/passenger/lib/phusion_passenger/abstract_server.rb 194 in `start_synchronously'
13 /dh/passenger/lib/phusion_passenger/abstract_server.rb 163 in `start'
14 /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb 209 in `start'
15 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 262 in `spawn_rails_application'
16 /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb 126 in `lookup_or_add'
17 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 256 in `spawn_rails_application'
18 /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb 80 in `synchronize'
19 /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize'
20 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 255 in `spawn_rails_application'
21 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 154 in `spawn_application'
22 /dh/passenger/lib/phusion_passenger/spawn_manager.rb 287 in `handle_spawn_application'
23 /dh/passenger/lib/phusion_passenger/abstract_server.rb 352 in `__send__'
24 /dh/passenger/lib/phusion_passenger/abstract_server.rb 352 in `main_loop'
25 /dh/passenger/lib/phusion_passenger/abstract_server.rb 196 in `start_synchronously'
26 /dh/passenger/bin/passenger-spawn-server 61
Anyone got any ideas on why I'm still missing a gem when I've unpacked it?
回答1:
The problem is in shared hosting. There you usually have common gems repository for all users and local in your home directory for only you. The problem can be solved by specifying correct paths in your config/preinitializer.rb or config/environment.rb
ENV['GEM_PATH'] = '/home/[username]/ruby/gems:/usr/lib/ruby/gems/1.8'
Gem.clear_paths
This is path structure on my hosting, you may need to updated it for yours.
edit
Checked my sources, you may also need to add this before those lines:
require 'rubygems'
require 'rubygems/gem_runner'
来源:https://stackoverflow.com/questions/3214658/deploying-a-rails-app-on-dreamhost-issue