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.
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
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.
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.
Related
I am in process of installing Redmine app via RedmineInstall documentation I try step 5 :
bundle exec rake db:migrate
then error shows :
bundler: command not found: rake
Install missing gem executables with ´bundle install´
I use redmine 3.3.0 64 for windows
I use redmine gemfile and rake was installed (i see Using rake 11.2.2)
I tried reinstall it via bundle install or gem install/uninstall, but did not help (see Successfully installed rake-11.2.2 but rake do not work).
I tried this command from ruby/bin directory or redmine directory not success.
I do not understand, that rake is successfully installed, but when i try use it with bundle it says that command not found.
The problem may be in the directory where the Redmine or rake?
Try rake db:migrate in your redmine directory without bundle exec and see if that resolves your issue.
Bundler usually provides bin stubs for rake and other gem files, so that bundle exec is not necessary or will even fail because it will look in an other gem directory where, in this case, rake might not be installed.
When I do rake db:migrate, I get the following error:
rake aborted!
Gem::LoadError: You have already activated rake 10.2.2, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
How can solve this?
This error is due to the fact that some applications may specify different versions of gems than the ones you have installed.
Try using bundle exec rake db:migrate.
Using bundle exec guarantees that the program is run with the environment specified in the gemfile.
Perhaps:
bundle exec rake db:migrate
There might be other gems in the Gemfile which are dependent on rake 10.2.2, while you are trying to install rake 10.1.0 via your gemfile or explicitly mentioned it. A look into your Gemfile will help.
In case you have specific environment, you may want to run
bundle exec rake db:migrate
to make sure you are running it appropriately.
As per another answer given on this topic, you can also try deleting the Gemfile.lock file and re-running bundle install to regenerate the Gem dependencies.
Platform: windows 7, running on JRuby 1.6.8.
C:\project> rake db:migrate
rake aborted!
You have already activated rake 10.0.3, but your Gemfile requires rake 0.9.2.2.
Using bundle exec may solve this.
OK. I have added
gem "rake", "= 0.9.2.2"
to Gemfile and ran:
C:\project> bundle exec rake db:migrate
bundler: command not found: rake
Install missing gem executables with `bundle install`
<polite>WTF?</polite>
I have also done
bundle install --deployment
to no avail.
I have different versions of rake installed:
C:\project>gem list
LOCAL GEMS
...
rake (10.0.3, 0.9.2.2, 0.8.7)
How to resolve this? I need rake db:migrate working with my specific (inherited) RoR project with gems that tend to be slightly out of date, but they are all specified in Gemfile.
Don't run bundle --deployment until you clearly understand what it is used for. (it's confusing, we usually use bundle install --path vendor/bundle)
The first error means, that you should execute your command with bundle exec, like bundle exec rake db:migrate
after the version change in the Gemfile you should have just run bundle install without --deployment.
At this point I'd recommend to delete the .bundle folder in your project home, this reverses the --deployment call. Afterwards call bundle install and try it again. If it doesn't work please let us know.
Don't get frustrated, bundle is pretty cool as soon as you get the hang of it.
I seem to have a similar problem as this post, where Bundler complains of a gem not being checked out. However, mine shows an error when running a rake task using a cron job. (Otherwise, the site seems to deploy fine in production using Phusion Passenger, and the rake task runs when called in the command line )
The error is:
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/source.rb:571:in load_spec_files': git://github.com/moneill/Google-Maps-for-Rails.git (at modified_markers) is not checked out. Please runbundle install` (Bundler::GitError)
I tried using bundle install --deployment ; bundle pack followed by bundle install --path vendor/cache.
One thing I haven't tried is to locally compile the git project and install the gem in the vendor/bundle folder. I am not using RVM for this particular server.
The cron job command is cd /home/[dir]/[rails_app_folder]/ && RAILS_ENV=production /usr/local/bin/bundle exec rake [task] --trace
Thank you!
My Capistrano deploy:migrate task is set to run a simple rake db:migrate command, as follows:
env PATH=/home/user/.gems/bin sh -c 'cd /home/user/app/releases/20121003140503 && rake RAILS_ENV=production db:migrate'
When I run this task during an ssh session manually it completes successfully. However when I run from my local development box, I receive the following error:
** [out :: app] Could not find rake-0.9.2.2 in any of the sources
I am able to locate my rake gem by typing which rake via ssh (/home/user/.gems/bin/rake) and rake --version gives me "rake, version 0.9.2.2," so I don't understand why this command fails via Capistrano?
Capistrano does not place bundle exec before rake command in default. If you are sure you have the rake gem in your bundle, try adding this to your deploy.rb.
set :rake, 'bundle exec rake'
This will tell Capistrano to instead of just rake run bundle exec rake. If it is in your bundle, you won't have any problems any more and you will also avoid collisions if you have more versions of rake installed on your system.
You might also just need to bundle your gems with this:
require "bundler/capistrano"
Via: Why is Capistrano not installing gems with bundler?
Once you go into your app folder, you simply type:
$bundle exec rake instead of just $rake