Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no such file to load -- rack

Sometimes, my rails application gives an error (no such file to load -- rack) even if rack is installed.

[Gemfile] gem 'rack', '1.2.1'

If I refresh the page, it loads fine. So it's not the gem problem. What could cause the error?

Thanks.

Sam

like image 301
Sam Kong Avatar asked Oct 10 '22 00:10

Sam Kong


1 Answers

I think if you start your website locally, this will not happen. So what service did you use? I've encountered this kind of bugs on DreamHost.

For DreamHost, the problem is they use different version (older) of Rack, which is not compatible with newest version of Rails. Try to specify the Rack version in your Gemfile (and in most cases, you have to downgrade Rails as well). It may help.

Another possible reason is that you use RVM on your local machine, but for servers, for example, Passenger + Nginx/Apache, RVM may not work well (actually, I'm always getting errors using Passenger + RVM). Specifying your Gem directory may help.

like image 182
Davidsun Avatar answered Oct 13 '22 11:10

Davidsun