0

When running bundle exec rake assets:precompile on my dev machine I get a rake aborted error:

cannot load such file -- rack/google_analytics

This is in my gemfile in the production group so isn't installed on my dev machine:

group :production do
    gem 'rack-google_analytics', :require => "rack/google_analytics"
end

Any ideas how to fix this? I am running rake 0.9.2.2 and Rails 3.2.1. If required, I can provide more info.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
Rich
  • 2,164
  • 1
  • 25
  • 39
  • Not sure if you seen this already? http://stackoverflow.com/questions/8020852/rails-3-1-1-deploy-to-heroku-failing – satish v Jul 06 '12 at 20:20

3 Answers3

1

When I changed the following value to true from false (in config/environments/production.rb), I could get rid of the above error

config.assets.compile = true

satish v
  • 21
  • 2
1

The only way I could resolve this was to comment out the Production group in my gemfile, and then running:

bundle install
bundle exec rake assets:precompile

Then uncommenting, running bundle install again and pushing to git/deploying with capistrano.

Rich
  • 2,164
  • 1
  • 25
  • 39
  • I'd like to resolve a proper answer, rather than this hack though. The reason I'm precompiling locally is that I can't use `load 'deploy/assets'` in my capfile as the production server chokes from not having devlopment/test group gems (specificially it aborts rake with `no such file to load -- faker`. So if someone can suggest a better answer, I can set them as the accepted answer instead. – Rich Jul 09 '12 at 06:52
0

I'm guessing the reason you are experiencing this is that you had previously done a:

bundle install --without production

Some versions of bundler cache this command and run it as default. Try running something like this to clear the cache:

bundle install --without santa

Your next command

bundle exec rake assets:precompile

should work fine again.

thatdankent
  • 950
  • 8
  • 15