I have recently installed Ruby on Rails on my Centos server as practice for installing in a production environment. In my Gemfile I have the following uncommented lines:
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'mysql2'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'execjs'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
Here is the RVM info of my install:
]# rvm list
rvm rubies
=* ruby-2.0.0-p353 [ x86_64 ]
# => - current
# =* - current && default
# * - default
And my rake about:
]# rake about
About your application's environment
Ruby version 2.0.0 (x86_64-linux)
RubyGems version 2.2.0
Rack version 1.5
Rails version 4.0.2
JavaScript Runtime therubyracer (V8)
Active Record version 4.0.2
Action Pack version 4.0.2
Action Mailer version 4.0.2
Active Support version 4.0.2
Middleware Rack::Sendfile, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000004c79418>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag
Application root /var/www/html/omcw
Environment development
Database adapter mysql2
Database schema version 0
I am working from a Pragmatic Programmers guide, and doing the steps on Windows using the DevKit worked fine using webricks, so I assumed it should just work on Linux as well. I have connected to a mysql db for the backend, which as far as I know is working fine, my database.yml is not attached due to link restrictions, please let me know if you want to see it.
All I have done so far is create a new application, which when viewed through webricks works fine (this doesn't display on my httpd service - but I believe this is by design as there is no routing set up for this from what I understand from the error I saw - not something I am overly concerned with yet). I then set up an application with:
rails generate controller Say hello goodbye
When I try to access the page host:3000/say/hello I get a page that returns this error:
Sprockets::FileNotFound in Say#hello
Showing /var/www/html/omcw/app/views/layouts/application.html.erb where line #6 raised:
couldn't find file 'execjs'
(in /var/www/html/omcw/app/assets/javascripts/application.js:13)
Extracted source (around line #6):
<head>
<title>Omcw</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>
I have copied the output from the framework trace at pastebin
Finally, my bundle install lists execjs as being installed:
]# bundle show execjs
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2
If I view the page view port 80, I see this in the web browser:
Web application could not be started
Cannot execute "/usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/buildout/agents/SpawnPreparer": No such file or directory (errno=2)
Application root
/var/www/html/omcw
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV and PASSENGER_ENV)
production
Ruby interpreter command
/usr/local/rvm/wrappers/ruby-2.0.0-p353/ruby
User and groups
Unknown
Environment variables
Unknown
Ulimits
Unknown
My httpd error log:
App 24331 stderr: Cannot execute "/usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/buildout/agents/SpawnPreparer": No such file or directory (errno=2)
[ 2014-01-04 11:04:31.2524 3414/7f38c941e700 Pool2/Implementation.cpp:882 ]: Could not spawn process for group /var/www/html/omcw#default: An error occured while starting up the preloader.
in 'void Passenger::ApplicationPool2::SmartSpawner::handleErrorResponse(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)' (SmartSpawner.h:455)
in 'std::string Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)' (SmartSpawner.h:590)
in 'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()' (SmartSpawner.h:206)
in 'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:752)
in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const Passenger::ApplicationPool2::SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:803)
[ 2014-01-04 11:04:31.2530 3414/7f38c9e60700 agents/HelperAgent/RequestHandler.h:2065 ]: [Client 20] Cannot checkout session.
Error page:
Cannot execute "/usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/buildout/agents/SpawnPreparer": No such file or directory (errno=2)
I am sure I am doing something wrong here, but I have tried searching around the errors I am seeing and everything I have tried hasn'tfixed tis issue. I have the error message stating that execjs cannot be found, but I have it installed, is this a red herring, or am I missing something?
I did try to remove the execjs mention from my Gemfile, I hoped this would mean it simply would use therubyracer, but this didn't work either.
Thanks for any help! Please let me know if you need any more info.