I am trying to start Passenger with a Sinatra app on an Amazon EC2 instance and I get the following error:
$ 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.
Here is my config.ru file:
require './app'
run Sinatra::Application
and my gem file:
source 'https://rubygems.org'
source 'https://rubygems.org'
gem 'sinatra'
gem 'nokogiri'
gem 'pony'
gem 'passenger'
Is the error related to json? I tried installing the json gem but I still get this error. Any help would be appreciated.
Thank you.
I was able to finally get it working....
I had to manually add gem 'json' into my Gemfile and then did bundle install. After reading the errors, I figured that it had something to do with the pony gem. I am guessing that there was a dependency for pony (json gem) that was not being picked up by the bundler.
Related
I'm trying to do a Rails server won't start, I'm using linux to run the code.
Console result:
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/oblivio/Applications/Ruby/blog/blog/config/boot.rb:4:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
try to type 'spring stop' in your rails app. And retry 'rails s'
im trying to get started with rails. I have made a rails project and now im trying to start the server but get this.
C:\Users\Home\Documents\Sites\simple_cms>rails server
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:134:in `require'
from C:/Users/Home/Documents/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
my gemfile has gem 'mysql2', '~> 0.3.18'
windows 7
ruby version 2.2.1
rails 4.2.1
mySql server version 5.6.24
Edit:
Couldn't find a solution that worked for me so i installed a different version of rails and it worked out.
Make sure you have installed mysql2 gem using bundle install and that bundle install has returned successful installation.
#James, This issue has been already raised so follow these links and hope this may help you.
1) Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0
2) Ruby on Rails - cannot load such file -- mysql2/2.2/mysql2 (LoadError)
3) https://github.com/bundler/bundler/issues/3456
Try to change
gem 'mysql2', '~> 0.3.18'
to
gem 'mysql2', '~> 0.3.11'
I think that maximum compatible version with Windows is 0.3.11. Then run again bundle install
Hi all I am working with Phusion Passenger and I go to run my web app and it gives me Ruby 2.0 is not a valid platform. Here is my output below, any ideas?
Thanks!
ruby_20` is not a valid platform. The available options are: [:ruby, :ruby_18, :ruby_19, :mri, :mri_18, :mri_19, :rbx, :jruby, :mswin, :mingw, :mingw_18, :mingw_19] (Bundler::DslError)
/usr/lib/ruby/vendor_ruby/bundler/dsl.rb:209:in `block in _normalize_options'
/usr/lib/ruby/vendor_ruby/bundler/dsl.rb:207:in `each'
/usr/lib/ruby/vendor_ruby/bundler/dsl.rb:207:in `_normalize_options'
/usr/lib/ruby/vendor_ruby/bundler/dsl.rb:56:in `gem'
/home/bistro/openproject/Gemfile:82:in `evaluate'
/usr/lib/ruby/vendor_ruby/bundler/dsl.rb:7:in `instance_eval'
/usr/lib/ruby/vendor_ruby/bundler/dsl.rb:7:in `evaluate'
/usr/lib/ruby/vendor_ruby/bundler/definition.rb:17:in `build'
/usr/lib/ruby/vendor_ruby/bundler.rb:136:in `definition'
/usr/lib/ruby/vendor_ruby/bundler.rb:124:in `load'
/usr/lib/ruby/vendor_ruby/bundler.rb:107:in `setup'
/usr/lib/ruby/vendor_ruby/bundler/setup.rb:17:in `<top (required)>'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.9.1/gems/passenger-4.0.29/lib/phusion_passenger/loader_shared_helpers.rb:219:in `block in run_load_path_setup_code'
/var/lib/gems/1.9.1/gems/passenger-4.0.29/lib/phusion_passenger/loader_shared_helpers.rb:333:in `running_bundler'
/var/lib/gems/1.9.1/gems/passenger-4.0.29/lib/phusion_passenger/loader_shared_helpers.rb:217:in `run_load_path_setup_code'
/var/lib/gems/1.9.1/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:96:in `preload_app'
/var/lib/gems/1.9.1/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:153:in `<module:App>'
/var/lib/gems/1.9.1/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/var/lib/gems/1.9.1/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:28:in `<main>'
I have tried updating Ruby Gems, Updating Bundler, reinstalling Phusion - and I am not sure what else to do. Any thoughts?
Update 2:
I updated the Gem files in the Open project directory and still nothing.
It looks like Bundle updated now I am getting a different error:
Cannot execute "/var/lib/gems/1.9.1/gems/passenger-4.0.29/buildout/agents/SpawnPreparer": No such file or directory (errno=2) Application root /home/bistro/openproject Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV and PASSENGER_ENV) production Ruby interpreter command /usr/bin/ruby1.9.1 User and groups Unknown Environment variables Unknown Ulimits Unknown
I was trying to setup facebook app locally, using ruby and sinatra, in Kubuntu 12.04.
I have included following gems in my gemfile. I have postgresql installed in my system and I am able to run the postgresql command line and run basic commands as createdb, create table etc.
gem "sinatra"
gem "koala"
gem "json", "1.5.5"
gem "httparty"
gem "thin"
gem "rack", "1.3.10"
gem "pg"
gem "activerecord"
gem "sinatra-activerecord"
And in my app.rb file added these files,
require "rubygems"
require "sinatra"
require "sinatra/activerecord"
require "koala"
require "./config/environment" #database configuration
Running
rake -T
in my terminal gives me the following error.
rake aborted!
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:39:in `database_file='
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1033:in `set'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:50:in `registered'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1317:in `block in register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `each'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1648:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1688:in `register'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:76:in `<module:Sinatra>'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:6:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/app.rb:3:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/Rakefile:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Could any one please help. Thank you.
As #iain mentioned, this is due to a parse error in your config/database.yml file.
Check that it is valid syntax, and replace any tabs with spaces.
I've been trying to get a simple hello world web app running on Sinatra.
I have the following setup:
config.ru
require 'hello.rb'
run Sinatra::Application
hello.rb
require "sinatra"
get "/" do
"Hello World!\n"
end
Gemfile
source :rubygems
gem 'sinatra'
This works on my local machine if I run ruby hello.rb, ruby1.9.1 hello.rb or rackup and go to the correct address in my browser. However, this doesn't work when deployed to heroku or if I run rackup1.9.1. I get the following error:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- hello.rb (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from config.ru:1:in `block in <main>'
from /usr/lib/ruby/1.9.1/rack/builder.rb:46:in `instance_eval'
from /usr/lib/ruby/1.9.1/rack/builder.rb:46:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /usr/lib/ruby/1.9.1/rack/builder.rb:35:in `eval'
from /usr/lib/ruby/1.9.1/rack/builder.rb:35:in `parse_file'
from /usr/lib/ruby/1.9.1/rack/server.rb:113:in `app'
from /usr/lib/ruby/1.9.1/rack/server.rb:189:in `wrapped_app'
from /usr/lib/ruby/1.9.1/rack/server.rb:155:in `start'
from /usr/lib/ruby/1.9.1/rack/server.rb:83:in `start'
from /usr/bin/rackup1.9.1:4:in `<main>'
How can I get this working? I'm guessing config.ru should be different but I don't know what to change.
Try doing
require './hello'
or
require_relative 'hello'
The current directory is not present in the LOAD_PATH by default in Ruby 1.9.2.