Rails: no such file to load -- rack/mini/profiler (LoadError)

Hi, I wanted to try MiniProfiler for Rails as I think it looks great.

I’m using ruby enterprise edition 1.8.7 with rvm and rails 3.0.9

I included in my gem file:

gem "rack-mini-profiler"

then I did:

=>:$ bundle install

then I did:

=>:$ rails server

and I got:

/Users/nemesis/.rvm/gems/ree-1.8.7-2012.02@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:74:in `require': no such file to load -- rack/mini/profiler (LoadError)
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:74:in `require'
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02@global/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
from /Users/nemesis/openwisp/geomonitoring/config/application.rb:7
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02/gems/railties-3.0.9/lib/rails/commands.rb:28:in `require'
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02/gems/railties-3.0.9/lib/rails/commands.rb:28
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /Users/nemesis/.rvm/gems/ree-1.8.7-2012.02/gems/railties-3.0.9/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6

Any hint?

Thank you for this great gem.

Have not tested a 1.8.7, 3.0.9 combo.

Any chance you can you link to a repro on Github?

You meant repo or repro (what is a repro?) ?

This is the rails app I’m working on. Is Open Source.
https://github.com/openwisp/OpenWISP-Geographic-Monitoring/tree/develop

I’am working on the develop branch.

Rack::Bug reports hundred of queries for each page so I wanted to use some other instrument to verify it.

Thanks a lot!

Had the exact same problem a while ago; Ruby 1.9.3, Rails 3.2.6. Finally figured it out – when I was running “sudo bundle install”, for some weird reason, bundler was installing rack-mini-profiler in my gems directory with owner root, group root, mode 0660 on all the regular files. Hence, rack_mini_profiler.rb was unreadable, and bundler would silently fail when trying to load it.

(Let’s leave aside the whole “silently failing” issue for the moment – god, what a pain…)

Now, let’s not close this bug just yet – this is the only gem that I’ve ever had installed with bogus permissions, and it happens reliably, even after "gem uninstall"ing all versions of rack-mini-profiler and letting bundler install a fresh one. Any ideas why?

Starting with the gem for 0.13.pre, the permissions are wrong in the tarball inside the gem itself. I did this by installing all the released versions on rubygems into a local directory and running ls -l on them. Annoyingly manual, but it’s done now…

Whoever is packaging the gems has bad ownership flags set on their checkout and it is propagating to the released gems.

Sam, did something happen to your computer around the end of August (based on release dates)?

chmod -R +r Ruby/ in the checkout before releasing the next version should fix it, I think.

This would never show up for RVM users, since the gem would be owned by the user. Also, production environments using bundler, because the gems are installed locally.

UPDATE Running sudo chmod -R +r /var/lib/gems/1.9.1/gems/rack-mini-profiler-0.1.21/ after installing made the error go away.

@Ryan, big thank you on that.

This was a side effect of me stripping x from a bunch of files. I just pushed a release that fixes this !!!

I was running into the migration error:
no file found for …/tmp/miniprofiler

After digging a bit, I came across this thread.
The patch to fix this error has not been merged. A quick fix is simply to create the directory in your app folder …/tmp/miniprofiler

After doing so, my migrations ran without incident.

Thanks again for this great tool – It has done wonders to help optimize my app!

will have a look! thanks!

this sounds very very strange, we have nothing particularly special in our install process, anyone else got an idea here?

hey, enjoy your detective badge, you deserve it

cool, glad it helped, I did pull that fix in a while back, perhaps your gem is a bit old?