Rich
Rich

Reputation: 2174

Rake aborted! when locally Precompiling Assets

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.

Upvotes: 0

Views: 497

Answers (3)

thatdankent
thatdankent

Reputation: 950

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.

Upvotes: 0

Rich
Rich

Reputation: 2174

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.

Upvotes: 1

satish v
satish v

Reputation: 21

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

Upvotes: 1

Related Questions