我正在关注Rails网站上的Rails3教程第2版。但是,我不想使用rails服务器,而是想在OS X Lion上使用我的apache设置。因此,我安装了乘客和乘客偏好窗格。我可以毫无问题地进入欢迎页面但是如果我单击链接查看我的应用程序环境,我会收到以下错误消息:
Ruby (Rack) application could not be started
These are the possible causes:
There may be a syntax error in the application's code. Please check for such errors and fix them.
A required library may not installed. Please install all libraries that this application requires.
The application may not be properly configured. Please check whether all configuration files are written correctly, fix any incorrect configurations, and restart this application.
A service that the application relies on (such as the database server or the Ferret search engine server) may not have been started. Please start that service.
Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.
Error message:
Could not find coffee-script-source-1.3.1 in any of the sources (Bundler::GemNotFound)
Exception class:
PhusionPassenger::UnknownError
Application root:
/Users/ash/NetBeansProjects/ruby/first_app
Backtrace:
# File Line Location
0 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/spec_set.rb 90 in `materialize'
1 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/spec_set.rb 83 in `map!'
2 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/spec_set.rb 83 in `materialize'
3 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb 127 in `specs'
4 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb 172 in `specs_for'
5 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb 161 in `requested_specs'
6 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/environment.rb 23 in `requested_specs'
7 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb 11 in `setup'
8 /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler.rb 107 in `setup'
9 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb 326 in `prepare_app_process'
10 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 156 in `initialize_server'
11 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb 572 in `report_app_init_status'
12 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 154 in `initialize_server'
13 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'
14 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 180 in `start'
15 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 129 in `start'
16 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 253 in `spawn_rack_application'
17 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb 132 in `lookup_or_add'
18 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 246 in `spawn_rack_application'
19 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb 82 in `synchronize'
20 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize'
21 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 244 in `spawn_rack_application'
22 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 137 in `spawn_application'
23 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
24 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 357 in `__send__'
25 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop'
26 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously'
27 /Library/Ruby/Gems/1.8/gems/passenger-3.0.12/helper-scripts/passenger-spawn-server 99
如果我查看/Library/Ruby/Gems/1.8/
和任何子目录,我找不到咖啡脚本的参考。但是,快速ash$ bundle show coffee-script-source
向我显示gem文件位于/Users/ash/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/coffee-script-source-1.3.1
(n.b。如果我使用rails服务器我没有这个问题,但这不是我想要的解决方案)
作为一个全新的Ruby新手,我应该如何配置我的Passenger设置以找到正确的文件?
答案 0 :(得分:4)
Phusion可能只知道你的系统宝石在哪里,而不是你的rvm宝石;您需要设置GEM_HOME
环境变量以显示它的位置。
如果你正在使用apache,可能你有一个.htaccess
文件来启动Phusion。在那里,在PassengerEnabled行之前,添加
SetEnv GEM_HOME '/Users/ash/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems'
另一种方式,我认为应该在没有Apache的情况下工作,就是在应用程序的config目录中创建一个名为setup_load_paths.rb的文件(如果它不存在)并添加以下行:
ENV['GEM_HOME']='/Users/ash/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems