I'm having trouble pushing my project to Heroku
it's telling me I'm missing a gem rake 11.1.2
yet running gem list rake
tells me I do have rake 11.1.2 installed.
This issue was resolved by removing vendor/cache
from the codebase before pushing to Heroku. This potentially confusing result arises from the differences in behavior exhibited by bundle
under different circumstances.
Using bundle
at your workstation, the command will exhibit this behavior:
While installing gems, Bundler will check vendor/cache and then your system's gems. If a gem isn't cached or installed, Bundler will try to install it from the sources you have declared in your Gemfile.
This yields the results expected by the OP, a working setup.
The bundle
command on Heroku, however, is preparing to run your application under web traffic load, an entirely different set of stresses from development. On Heroku, the bundle
command executes with the --deployment
flag, which will exhibit this behavior:
If you have run bundle pack, checked in the vendor/cache directory, and do not have any git gems, Bundler will not contact the internet while installing your bundle.
Bundler is making the assumption here, based on the presence of the vendor/cache
directory, that the bundle pack
command has been run,and the gems are pre-provisioned. Since rake
, then, wasn't present in vendor/cache
this was the resulting error.
OP may have resolved the issue by either removing the relevant gems from vendor/cache
or by issuing the bundle pack
command and checking the gems into source control. The first is more common.