我正在尝试在Amazon EC2实例上使用Sinatra应用启动Passenger,我收到以下错误:
$ passenger start -e production
=============== Phusion Passenger Standalone web server started ===============
PID file: /home/ec2-user/github/mainpage/tmp/pids/passenger.3000.pid
Log file: /home/ec2-user/github/mainpage/log/passenger.3000.log
Environment: production
Accessible via: http://0.0.0.0:3000/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check https://www.phusionpassenger.com/documentation/Users%20guide%20Standalone.html#troubleshooting
===============================================================================
App 29028 stdout:
App 29028 stdout:
[ 2015-01-20 05:16:52.8259 28997/7fb5c6463700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /home/ec2-user/github/mainpage: An error occured while starting up the preloader.
Error ID: 0ad6d346
Error details saved to: /tmp/passenger-error-911MCI.html
Message from application: cannot load such file -- json (LoadError)
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/type.rb:4:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/type.rb:4:in `<top (required)>'
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/types.rb:3:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/types.rb:3:in `<top (required)>'
/home/ec2-user/.gem/ruby/2.0/gems/mail-2.6.3/lib/mail.rb:9:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/mail-2.6.3/lib/mail.rb:9:in `<module:Mail>'
/home/ec2-user/.gem/ruby/2.0/gems/mail-2.6.3/lib/mail.rb:2:in `<top (required)>'
/home/ec2-user/.gem/ruby/2.0/gems/pony-1.11/lib/pony.rb:1:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/pony-1.11/lib/pony.rb:1:in `<top (required)>'
/home/ec2-user/github/mainpage/app.rb:9:in `require'
/home/ec2-user/github/mainpage/app.rb:9:in `<top (required)>'
config.ru:1:in `require'
config.ru:1:in `block in <main>'
/home/ec2-user/.gem/ruby/2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
/home/ec2-user/.gem/ruby/2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:112:in `eval'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:112:in `preload_app'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:28:in `<main>'
[ 2015-01-20 05:16:52.8332 28997/7fb5bffff700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is 0ad6d346. Please see earlier logs for details about the error.
这是我的config.ru文件:
require './app'
run Sinatra::Application
和我的宝石文件:
来源&#39; https://rubygems.org&#39;
source 'https://rubygems.org'
gem 'sinatra'
gem 'nokogiri'
gem 'pony'
gem 'passenger'
错误与json有关吗?我尝试安装json gem,但我仍然遇到此错误。任何帮助将不胜感激。
谢谢。
答案 0 :(得分:0)
我终于可以让它工作了....
我必须手动将gem 'json'
添加到我的Gemfile中,然后执行bundle install
。在阅读错误后,我发现它与小马宝石有关。我猜测有一个依赖小马(json gem)没有被捆绑者拿起。