5

I'm working with Elastic Beanstalk and I'm getting this error in my logs-

You have already activated rack 1.6.0, but your Gemfile requires rack 1.6.4. Prepending bundle exec to your command may solve this. (Gem::LoadError)

I've seen all related questions(Related Question) but nothing worked for me. When I do gem list | grep rack i get-

rack (1.6.4)
rack-test (0.6.3)

That means I don't have rack(1.6.0) installed, which is confirmed when I do gem uninstall rack -v 1.6.0 it gives me-

ERROR: While executing gem ... (Gem::InstallError) gem "rack" is not installed

What should I do? Should I uninstall rack 1.6.4? (that gives me a warning that I won't have any rack versions)

Community
  • 1
  • 1
pyron_orion
  • 545
  • 5
  • 18
  • What does it say in your Gemfile.lock? I would run a bundle update rack. Maybe you have it locked at 1.6.0? – Catherine Cai Aug 27 '15 at 06:18
  • 1
    I tried bundle update rack and it said 'Using rack 1.6.4'(along with all other gems) and this is my gemfile.lock http://textuploader.com/al5o1. It has rack 8 different times and i don't know what it exactly means. – pyron_orion Aug 27 '15 at 06:26
  • I would try to delete your Gemfile.lock and run bundle again. There's a dependency issue somewhere. Failing that, I would roll back to rack 1.6.0 unless you really need 1.6.4... – Catherine Cai Aug 27 '15 at 06:42
  • I deleted my Gemfile.lock and ran bundle, didnt help. I rolled back to 1.6.0 but when i do bundle install after that, it installls 1.6.4 as well. So then i have both versions. – pyron_orion Aug 27 '15 at 06:53
  • I think its happening because i have the gem unicorn in my gemfile and that gem has a dependency on rack >= 0 and thats why both versions gets installed but i don't why it only shows 1 version to me and how to fix it – pyron_orion Aug 27 '15 at 08:16
  • Thanks it worked. I rolled back to 1.6.0 and locked it at this version so that it doesnt update when i do bundle install and that did the trick. i think that unicorn was installing 1.6.0 on runtime so i just removed 1.6.4 altogether. – pyron_orion Aug 27 '15 at 08:26

2 Answers2

6

There appears to be some sort of sniffing of the gemfile going on. Try adding your ruby server to the gemfile explicitly e.g.

gem 'puma'

This convinced EB to load the rack specified in the Gemfile in my case.

bkconrad
  • 2,620
  • 3
  • 20
  • 30
  • Yes this worked for me too! I was racking(hehe) my brains trying to figure out how to get EB to use the rack version I wanted. I guess you could probably specify the rack version in your Gemfile too? I needed puma so this works tho. – yoyodunno Mar 14 '16 at 21:59
-3

I deleted my gemlock file and push my app to production . Then i get into my root-app folder of hosting . and ran the following command and it made my app work properly

gem install rack
Mani
  • 2,391
  • 5
  • 37
  • 81