I am trying to launch a rails application with mongrel on windows xp.
I believe the following error is version-specific but cannot pinpoint exactly what is missing (a gem overlooked perhaps or an incompatible version?)
My ruby version
C:\ruby -v
ruby 1.9.2p136 (2010-12-25) [i386-mingw32]
* LOCAL GEMS *
abstract (1.0.0)
actionmailer (3.0.4.rc1, 3.0.3, 2.2.3)
actionpack (3.0.4.rc1, 3.0.3, 2.2.3)
activemodel (3.0.4.rc1, 3.0.3)
activerecord (3.0.4.rc1, 3.0.3, 2.2.3)
activeresource (3.0.4.rc1, 3.0.3, 2.2.3)
activesupport (3.0.4.rc1, 3.0.3, 2.2.3)
arel (2.0.7)
builder (2.1.2)
bundler (1.0.10)
cgi_multipart_eof_fix (2.5.0)
erubis (2.6.6)
gem_plugin (0.2.3)
i18n (0.5.0)
mail (2.2.15)
mime-types (1.16)
minitest (1.6.0)
mongrel (1.2.0.pre2 x86-mingw32, 1.1.5 x86-mingw32)
mongrel_service (0.4.0)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.7)
rails (3.0.4.rc1, 3.0.3, 2.2.3)
railties (3.0.4.rc1, 3.0.3)
rake (0.8.7)
rdoc (2.5.8)
rubygems-update (1.5.0)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.24)
In my working directory I attempt to start the app with this command:
mongrel_rails start -e development -b 127.0.0.1 -p 3000
The error is:
C:\myApp>mongrel_rails start -e development -a 127.0.0.1 -p 3000
** Starting Mongrel listening at 127.0.0.1:3000
** Starting Rails with development environment...
:29:in require': no such file to load--
C:/myApp/config/../vendor/rails/railties/lib/initializer (LoadError)
from <internal:lib/rubygems/custom_require>:29:inrequire'
from C:/myApp/config/boot.rb:45:in load_initializer'
from C:/myApp/config/boot.rb:38:inrun'
from C:/myApp/config/boot.rb:11:in boot!'
from C:/myApp/config/boot.rb:109:in'
from :29:in require'
from <internal:lib/rubygems/custom_require>:29:inrequire'
from C:/myApp/config/environment.rb:11:in <top (required)>'
from <internal:lib/rubygems/custom_require>:29:inrequire'
from :29:in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
lib/mongrel/rails.rb:147:inrails'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
bin/mongrel_rails:116:in block (2 levels) in run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
lib/mongrel/configurator.rb:149:incall'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
lib/mongrel/configurator.rb:149:in listener'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
bin/mongrel_rails:102:inblock in run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
lib/mongrel/configurator.rb:50:in call'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
lib/mongrel/configurator.rb:50:ininitialize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
bin/mongrel_rails:86:in new'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
bin/mongrel_rails:86:inrun'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
lib/mongrel/command.rb:210:in run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/
bin/mongrel_rails:282:in'
from C:/Ruby192/bin/mongrel_rails:19:in load'
from C:/Ruby192/bin/mongrel_rails:19:in'
Any ideas or direction on how to about resolving this will much appreciated.If I am missing a file or gem, or if it is a version conflict, it is not clear which one is it.
Also given the different versions on the same gem installed, how could I start the rails app on mongrel specifying exactly what versions I want to use?
Thanks!
would you please paste the contents of your gem file?
make sure you have:
gem 'mongrel', '>= 1.2.0.pre2'
then run bundle install to update your gem.
run server: rails server mongrel
Related
I am unable to deploy Ruby on Rails application to heroku, I am getting Precompiling assets failed !. Its working fine in my localhost. I can't figure out what causing this issue. Also added config.assets.initialize_on_precompile = false in application.rb, but no helps. :(
Here is the log
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.5.2
New app detected loading default bundler cache
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Using minitest (4.7.5)
Using atomic (1.1.14)
Using tzinfo (0.3.38)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Installing multi_json (1.8.4)
Using polyglot (0.3.3)
Using activerecord-deprecated_finders (1.0.3)
Installing mime-types (1.25.1)
Installing i18n (0.6.9)
Using bcrypt-ruby (3.1.2)
Using sass (3.2.10)
Using thor (0.18.1)
Installing rake (10.1.1)
Installing ambry (0.3.1)
Installing highline (1.6.19)
Installing arel (4.0.2)
Installing fssm (0.2.10)
Installing net-ssh (2.7.0)
Installing dalli (2.6.4)
Using execjs (2.0.1)
Installing orm_adapter (0.4.0)
Using bundler (1.5.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Installing chunky_png (1.2.9)
Installing differ (0.1.2)
Installing httpauth (0.2.0)
Installing multipart-post (1.2.0)
Installing hashie (2.0.5)
Installing redis (3.0.4)
Installing oauth (0.4.7)
Installing rack-google-analytics (0.12.0)
Using rails_serve_static_assets (0.0.1)
Using rails_stdout_logging (0.0.3)
Installing newrelic_rpm (3.6.7.152)
Installing ref (1.0.5)
Using thread_safe (0.1.3)
Using rack-test (0.6.2)
Installing warden (1.2.3)
Installing jwt (0.1.8)
Using treetop (1.4.15)
Installing libv8 (3.16.14.3)
Installing bourbon (3.1.8)
Installing merit (1.6.1)
Installing similar_text (0.0.4)
Installing net-scp (1.1.2)
Using uglifier (2.2.1)
Installing net-sftp (2.1.2)
Installing net-ssh-gateway (1.2.0)
Installing sprockets (2.10.1)
Installing omniauth (1.1.4)
Installing faraday (0.8.8)
Using rails_12factor (0.0.2)
Installing leaderboard (3.3.0)
Using mail (2.5.4)
Installing compass (0.12.2)
Installing activesupport (4.0.2)
Installing omniauth-oauth (1.0.1)
Installing capistrano (2.15.5)
Installing compass-flexbox (1.1.3)
Installing oauth2 (0.8.1)
Installing compass-rails (1.1.3)
Installing activemodel (4.0.2)
Installing actionpack (4.0.2)
Installing omniauth-twitter (1.0.0)
Installing omniauth-oauth2 (1.1.1)
Installing rvm-capistrano (1.5.0)
Installing actionmailer (4.0.2)
Installing activerecord (4.0.2)
Using sprockets-rails (2.0.1)
Installing omniauth-facebook (1.4.1)
Installing mysql2 (0.3.14)
Installing railties (4.0.2)
Using jquery-rails (3.0.4)
Installing sass-rails (4.0.0)
Installing devise (3.1.0)
Installing rails (4.0.2)
Installing figaro (0.7.0)
Installing therubyracer (0.12.0)
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
Post-install message from newrelic_rpm:
# New Relic Ruby Agent Release Notes #
## v3.6.7 ##
* Resque-pool support
Resque processes started via the resque-pool gem weren't recognized by the
Ruby agent. The agent now starts correctly in those worker processes.
* Environment-based configuration
All settings in newrelic.yml can now be configured via environment variables.
See https://newrelic.com/docs/ruby/ruby-agent-configuration for full details.
* Fix compatibility issues with excon and curb instrumentation
This release of the agent fixes a warning seen under certain circumstances
with the excon gem (most notably, when excon was used by fog), as well as
a bug with the curb instrumentation that conflicted with the feedzirra gem.
* Allow license key to be set by Capistrano variables
A license key can be passed via a Capistrano variable where previously it
could only be in newrelic.yml. Thanks Chris Marshall for the contribution!
* Make HTTP client instrumentation aware of "Host" request header
If a "Host" header is set explicitly on an HTTP request, that hostname will
be used for external metrics. Thanks Mislav Marohnić for the contribution!
* Fix ActiveSupport::Concern warnings with MethodTracer
Including NewRelic::Agent::MethodTracer in a class using Concerns could cause
deprecation warnings. Thanks Mike Połtyn for the contribution!
* Fix Authlogic constant name
Code checking for the Authlogic module was using in the wrong case. Thanks
Dharam Gollapudi for the contribution!
See https://github.com/newrelic/rpm/blob/master/CHANGELOG for a full list of
changes.
Bundle completed (84.27s)
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
undefined method `split' for nil:NilClass
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/config/environments/production.rb:59:in `block in <top (required)>'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `class_eval'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `configure'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/config/environments/production.rb:1:in `<top (required)>'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `each'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `block in <class:Engine>'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `each'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/config/environment.rb:5:in `<top (required)>'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:250:in `block in run_tasks_blocks'
/tmp/build_c4ee6d25-fbcb-4b04-85c5-5f602f951339/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
Any help and suggestions are really appreciatable. Thanks
This is the problem:
undefined method `split' for nil:NilClass
It looks like it says it's on line 59 of production.rb -- have you got any reference to a split method in your app (esp the initialization process)?
Please set Heroku Labs: user-env-compile by
heroku labs:enable user-env-compile -a myapp
https://devcenter.heroku.com/articles/labs-user-env-compile
I'm trying to use the gem Whenever with Capistrano over my Rails app on 3.2.8, working with RVM and a gemset for that Rails version.
I'm getting the following error: Could not find rake-10.0.3 in any of the sources (Bundler::GemNotFound)
This is the output of the error (which I logged over a file):
/home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find rake-10.0.3 in any of the sources (Bundler::GemNotFound)
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `map!'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `materialize'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/definition.rb:113:in `specs'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/definition.rb:158:in `specs_for'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/definition.rb:147:in `requested_specs'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/environment.rb:23:in `requested_specs'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/runtime.rb:11:in `setup'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler.rb:116:in `setup'
from /home/some_user/.rvm/gems/ruby-1.9.3-p286#global/gems/bundler-1.2.1/lib/bundler/setup.rb:17:in `<top (required)>'
from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/some_user/some_user/config/boot.rb:6:in `<top (required)>'
from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/rails:5:in `<main>'
I did also get the error when I was using Rake 10.0.2 (I made bundle update and get Rake 10.0.3, and I leave it for testing). Also, I noticed that the bundler is searching over #global when I think it should search over the gemset (called #r328, and is located on /home/some_user/.rvm/gems).
.rvmrc (located inside of the project)
source ~/.profile
rvm use 1.9.3#r328
rvm_trust_rvmrcs_flag=1
.profile
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
schedule.rb (for testing)
set :output, "#{path}/log/cron.log"
every 1.minute do
runner "MenuOrder.send_resume(2)"
end
deploy.rb
set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"
The output of gem list
actionmailer (3.2.8)
actionpack (3.2.8)
active_utils (1.0.5)
activeadmin (0.5.0)
activemerchant (1.29.3, 1.28.0)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
arbre (1.0.1)
arel (3.0.2)
authorize-net (1.5.2)
bcrypt-ruby (3.0.1)
bourbon (3.0.1, 2.1.2, 2.1.1)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.13.5)
carrierwave (0.8.0, 0.7.1, 0.7.0)
chronic (0.9.0)
cocaine (0.4.2)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
daemon_controller (1.1.0)
daemons (1.1.9)
delayed_job (3.0.4)
delayed_job_active_record (0.3.3)
devise (2.2.0, 2.1.2)
erubis (2.7.0)
execjs (1.4.0)
fastercsv (1.5.5)
fastthread (1.0.7)
formtastic (2.2.1)
has_scope (0.5.1)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.1)
inherited_resources (1.3.1)
journey (1.0.4)
jquery-rails (2.1.4, 2.1.3)
json (1.7.6, 1.7.5)
kaminari (0.14.1)
mail (2.4.4)
meta_search (1.1.3)
mime-types (1.19)
money (5.1.0)
multi_json (1.5.0, 1.3.7, 1.3.6)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.6.2)
net-ssh-gateway (1.1.0)
nokogiri (1.5.6, 1.5.5)
orm_adapter (0.4.0)
paperclip (3.4.0, 3.3.1)
passenger (3.9.1.beta, 3.0.19, 3.0.18)
polyamorous (0.5.0)
polyglot (0.3.3)
rack (1.4.3, 1.4.1)
rack-cache (1.2)
rack-raw-upload (1.1.1, 1.1.0)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (10.0.3, 10.0.2, 0.9.2.2)
rdoc (3.12)
recaptcha (0.3.4)
responders (0.9.3)
rich (1.4.1, 1.3.1)
rmagick (2.13.1)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.5, 3.2.3, 3.2.1)
sass-rails (3.2.5)
sprockets (2.1.3)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35, 0.3.34)
uglifier (1.3.0)
warden (1.2.1)
whenever (0.8.1)
I tried with bundle update, removing Gemfile.lock and making bundle install, uninstalling all the rake gems (10.0.3 and 10.0.2) and installing the gem with bundle install but nothing worked.
You can use
bundle install --path vendor/cache
Hope this help you.
What I did to solve the problem was a little tricky:
Remove all the versions of Rake
Remove Gemfile.lock
Run bundle install
Install Rake manually with: gem install rake --version=10.0.2
Now it is working, but for some reason it doesn't write the log file. I will fix it and post the update.
Just a bundle install worked for me. I think it was because I had updated Ruby but then forgot to run bundler afterwards.
So that's the error you get when you're running a rake task or when you're setting up a rake task to when with cron? If you think it's the whatever gem, I KNOW there has been a lot of discussion about whenever not working because Capistrano actually changed around some internals and they've been slowly fixing them, but they haven't released an update to the gem.
Run a search through their issues and see if you can find what is related to you:
https://github.com/javan/whenever/issues
This problem is actually due to BUNDLE_PATH overriding the rvm gemset settings and storing the downloaded files elsewhere whenever you run bundle install. To solve this, you can either delete your .bundle folder or remove the BUNDLE_PATH line from .bundle/config. Just rerun bundle install once that's done and you should be good to go!
I'm maintaining an ancient RoR site that we're in the process of rewriting in Django. The site was written by someone else when Rails was in its infancy, and no one kept it updated until I got to it. A night or two ago, the server went down, I suspect due to a MySQL update. In the process of trying to fix it, we broke it, and now mongrel won't start. I see this in the mongrel log:
/home/USER/rails/SITE/config/boot.rb:26:Warning: Gem::SourcUSERdex#search support for String patterns is deprecated, use #find_name
/usr/local/lib/site_ruby/1.8/rubygems.rb:812:in `report_activate_error': RubyGem version error: rails(1.2.3 not >= 3.0) (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:223:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:258:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `each'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:33:in `require'
from /home/USER/rails/SITE/config/environment.rb:24
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `call'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `listener'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `call'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/local/bin/mongrel_rails:19:in `load'
from /usr/local/bin/mongrel_rails:19
I searched around and have tried to diagnose the error. It looks like mongrel wants us to have rails 3+ which isn't possible because we're going to be replacing the site in just a few weeks and don't want to bother bringing it up to date (it just needs to work for now). How can I force mongrel to run with the current version of rails?
In config/environment.rb, we have RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION which I thought would force Rails 1.2.3. Also, here's the output of gem list:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.2.2, 3.0.3, 1.3.3)
actionpack (3.2.2, 3.0.3, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activemodel (3.2.2, 3.0.3)
activerecord (3.2.2, 3.0.3, 1.15.6, 1.15.3)
activeresource (3.2.2, 3.0.3)
activesupport (3.2.2, 3.0.3, 1.4.4, 1.4.2)
acts_as_ferret (0.5.3, 0.4.3)
arel (3.0.2, 2.0.7)
builder (3.0.0, 2.1.2)
bundler (1.1.0, 1.0.9)
cgi_multipart_eof_fix (2.5.0)
daemons (1.1.8, 1.1.0)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
ferret (0.11.6)
gem_plugin (0.2.3)
hike (1.2.1)
i18n (0.6.0, 0.5.0)
jk-ferret (0.11.8.3, 0.11.8.2)
journey (1.0.3)
json (1.6.5)
mail (2.4.3, 2.2.15)
mime-types (1.17.2, 1.16)
mongrel (1.1.5)
multi_json (1.1.0)
polyglot (0.3.3, 0.3.1)
rack (1.4.1, 1.2.1)
rack-cache (1.2)
rack-mount (0.8.3, 0.6.13)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (1.2.3)
railties (3.2.2, 3.0.3)
rake (0.9.2.2, 0.8.7)
rdoc (3.12)
sprockets (2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10, 1.4.9)
tzinfo (0.3.32, 0.3.24)
Thanks for any and all help!
OK, I figured it out. It was incompatible gem(s). Luckily, we have a test server and a production server. We only messed with the test server last night (mongrel on the production server was working), so I did gem list on both servers, and it turned out the test server had quite a different list. I just installed and uninstalled gems on the test server until gem list produced identical lists on both servers.
Mongrel does require the latest rails version available, but your apps require rails 1.2.3, so there is a conflict.
The easiest way to avoid gems conflicts is by using different gemsets (with rvm or rbenv). Or remove the rails 3 gem if it isn't used...
I've been stuck on this for a bit and have read the Thin forum, googled everything I can think of, tried to see if I've using the wrong gem versions, so I hope someone can suggest how I can debug this problem.
I start Thin with this command line:
thin start -C /root/myapp/config/thin.yml -e production -d --adapter rack
I'm running nginx with the Thin web server on Amazon's EC2 with Rails 3.0.3 and Ruby 1.9.2-p290. Nginx and Thin run fine, but when an HTTP request is sent to Thin from nginx, Thin kicks out the following error and Nginx reqports "502 Bad Gateway":
!! Unexpected error while processing request: uninitialized constant ActiveSupport::Dependencies
uninitialized constant ActiveSupport::Dependencies
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:9:in `initialize'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:67:in `new'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:67:in `use'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.3/lib/rails/application.rb:190:in `block in default_middleware_stack'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.3/lib/rails/application.rb:189:in `tap'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.3/lib/rails/application.rb:189:in `default_middleware_stack'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.3/lib/rails/application.rb:161:in `app'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.3/lib/rails/application.rb:168:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/connection.rb:76:in `block in pre_process'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/connection.rb:74:in `catch'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/connection.rb:74:in `pre_process'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/connection.rb:57:in `process'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p290/bin/thin:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p290/bin/thin:19:in `<main>'
Here is my gem list:
* LOCAL GEMS *
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (3.0.3)
activemodel (3.0.3)
activerecord (3.0.3)
activeresource (3.0.3)
activesupport (3.0.3)
arel (2.0.10)
builder (2.1.2)
bundler (1.0.10 ruby)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
erubis (2.6.6)
eventmachine (0.12.10)
fastthread (1.0.7)
gem_plugin (0.2.3)
i18n (0.6.0)
mail (2.2.19)
mime-types (1.17.2)
mongrel (1.2.0.pre2)
multi_json (1.0.4)
mysql2 (0.2.18, 0.2.17)
polyglot (0.3.3)
rack (1.2.5, 1.2.4)
rack-cache (1.0)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.3)
railties (3.0.3)
rake (0.9.2.2)
redis (2.2.2)
redis-namespace (1.0.3)
resque (1.19.0)
resque-access_worker_from_job (0.3.1)
rmagick (2.13.1)
sinatra (1.2.8)
thin (1.2.7)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
vegas (0.1.8)
xmpp4r (0.5)
Here is my config.ru file:
#!/usr/bin/env ruby
require 'thin'
require 'rack'
require ::File.expand_path('config/environment', File.dirname(__FILE__) )
run Myapp::Application
I've also tried using thin 1.3.1 with no luck. I've tried eventmachine-1.0.0.beta.2, but the Gemfile keeps wanting to use 0.12.10, even though I deleted Gemfile.lock before running bundle install.
I think the error regarding ActiveSupport::Dependencies means that I am using the wrong libraries somewhere, but I don't know how to figure out which libraries are incorrect.
Does anyone know what is causing this problem, or have a suggestion on how to debug it?
This link set me on the right path. After adding require 'active_support/dependencies', I next added require 'action_controller'
to config.ru and I was able to access index.html through my URI. So my config.ru looks like
#!/usr/bin/env ruby
require 'thin'
require 'rack'
require 'active_support/dependencies'
require 'action_controller'
require ::File.expand_path('config/environment', File.dirname(__FILE__) )
run Myapp::Application
I have no idea why these requires are needed, but it seems to do the trick. The link says the reason is if you are using Rails 3 beta gems. Not sure if I am using such gems.
I'm hitting this error by using the package maintainer's version of thin when I should try to use the version of thin bundled with my app:
$ bundle exec thin start -C /root/myapp/config/thin.yml
Sadly, I'm trying to get thing to happen in a docker container so RVM is giving me an impossibly hard time running that command from entrypoint.sh. You might want to try removing the package maintainers version altogether apt-get remove thin and reinstalling thin with bundle install again.
Newbie alert...
Trying to fix a problem with my rails webrick server (i.e. get it started), I used an old Stackoverflow answer old answer and did the following command
sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
However, I forgot to change the version numbers. For example, my mysql is 0.3.6 (as opposed to the 0.2.6 in the command), and it is also libmysqlclient.18 instead of .16.
Now when I try to start rails server it says
Could not find gem 'mysql2 (~> 0.2.6)' in any of the gem sources listed in your Gemfile.
I tried to rerun this command with the updated versions but it didn't change anything...Indeed, it doesn't even ask me for my root password... Any ideas how I can reverse this problem?
Update -- this is the list of gems produced when I do gem list. The first person who answered this question suggested (in his comments) that I uninstall mysql .0.2.6 but that gem was never installed. When I did the name_tool command described above, it told the system to look for mysql 0.2.6, when I should have told it to look for mysql2-0.3.6.
abstract (1.0.0)
actionmailer (3.0.9, 3.0.7)
actionpack (3.0.9, 3.0.7)
activemodel (3.0.9, 3.0.7)
activerecord (3.0.9, 3.0.7)
activeresource (3.0.9, 3.0.7)
activesupport (3.0.9, 3.0.7)
arel (2.0.10)
builder (2.1.2)
bundler (1.0.14)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.19)
mime-types (1.16)
mysql2 (0.3.6)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.9, 3.0.7)
railties (3.0.9, 3.0.7)
rake (0.9.1)
rdoc (3.8)
rubygems-update (1.8.5)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27)
Update --after following instructions in Eric Hu's answer, I got this result when I ran rails server from my project folder
2011-07-26 01:49:17 rails s
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2.rb:9
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:120:in `require'
from /Users/michaelmitchell/Sites/simple_cms/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
Update -- I did bundle list as Eric suggested in his comment
Gems included by the bundle:
* abstract (1.0.0)
* actionmailer (3.0.9)
* actionpack (3.0.9)
* activemodel (3.0.9)
* activerecord (3.0.9)
* activeresource (3.0.9)
* activesupport (3.0.9)
* arel (2.0.10)
* builder (2.1.2)
* bundler (1.0.14)
* erubis (2.6.6)
* i18n (0.5.0)
* mail (2.2.19)
* mime-types (1.16)
* mysql2 (0.2.11)
* polyglot (0.3.1)
* rack (1.2.3)
* rack-mount (0.6.14)
* rack-test (0.5.7)
* rails (3.0.9)
* railties (3.0.9)
* rake (0.9.2)
* rdoc (3.8)
* thor (0.14.6)
* treetop (1.4.9)
* tzinfo (0.3.29)
I believe you're experiencing confusion over using bundler and RubyGems. When you gem install <gemname>, you're using a RubyGems commands to install the newest version of <gemname>.
Rails projects come with a gem called bundler, which also manages gems. Bundler builds a separate copy of gems for each Rails project that you create a Gemfile for. If you don't recall making a Gemfile, that's because it's one of the files that rails new <projectname> will generate for you.
Most likely, you haven't run a bundle install. Before you do, go to the folder for your current Rails project and open up Gemfile, just so you know what's going on. I'm willing to bet there's a line in there like this: gem 'mysql2', '~> 0.2.6'
To install the right version, go to your project folder in the command line. Type bundle install. Give it a minute and that should be it--try running rails s again.
If this seems confusing and unnecessary, just remember that when someone updates a gem, they could make it change in ways that would break your program. Bundler does you a service by ensuring that your program is running with specific versions of the gems needed (in this case, mysql2-0.2.6 instead of mysql2-0.3.6).
Clean out that gem and reinstall it.
Alternatively, RVM + Mac Homebrew for the MySQL installation works wonders.