1

My Sinatra application was running fine on Dreamhost until a few days ago (I'm not sure precisely when it went bad). Now when I visit my app I get this error:

can't activate rack (~> 1.1, runtime) for ["sinatra-1.1.2"], already activated rack-1.2.1 for []

I have no idea how to fix this. I've tried updating all my gems, then touching the app/tmp/restart.txt file, but still no fix.

I hadn't touched any files of my app, nor my Dreamhost account. It just busted on its own (my guess is DH changed something on their server which caused the bust).

When I originally deployed my app, I had to go through some hoops to get it working, and I seem to think I was using gems in a custom location, but I can't remember exactly where or how. I don't know my way around Rack/Passenger very well.

Here's my config.ru: (mostly grafted from around the web, I don't fully understand it)

ENV['RACK_ENV'] = 'development' if ENV['RACK_ENV'].empty? 
#### Make sure my own gem path is included first 

ENV['GEM_HOME'] = "#{ENV['HOME']}/.gems"  
ENV['GEM_PATH'] = "#{ENV['HOME']}/.gems:" 
require 'rubygems'
Gem.clear_paths  ## NB! key part 
require 'sinatra'



set :env,  :production
disable :run

require 'MY_APP_NAME.rb'

run Sinatra::Application
jbrennan
  • 11,943
  • 14
  • 73
  • 115

3 Answers3

0

Looks like you hit a non supportable Sinatra, Rack, Tilt version.

Take a look here how to solve that: http://codex.heroku.com/past/2010/12/14/sinatra_on_dreamhost/

include
  • 2,108
  • 16
  • 13
0

It's the typical gem activation problem. Use Bundler to get around it.

Hongli
  • 18,682
  • 15
  • 79
  • 107
0

You could try 'pinning' your gem versions before they are required. If you have command line access to the server try this:

gem list

This should show you which gems are installed. But you do say you have some custom gem paths which may not work for this. Something is calling a 'require "rack"' with a different version to what your application is expecting. It may be Passenger, which means the best you can hope for is to upgrade to the latest version of Sinatra.

After Gem.clear_paths, you could try this:

gem 'rack', '~>1.1'
gem 'sinatra', '~>1.0' # NB use whatever gem list shows you as the version of sinatra you were using when you deployed your application.
stef
  • 14,172
  • 2
  • 48
  • 70