97

I have been working with Rails and it sends me back this error. Please provide questions. Thanks for all the help. I will update this question with a better one because I don't know how to ask it.

Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources
~/.rvm/gems/ruby-2.0.0-p451/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92:in `block in materialize'
~/.rvm/gems/ruby-2.0.0-p451/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `map!'
~/.rvm/gems/ruby-2.0.0-p451/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `materialize'
~/.rvm/gems/ruby-2.0.0-p451/gems/bundler-1.6.2/lib/bundler/definition.rb:133:in `specs'
~/.rvm/gems/ruby-2.0.0-p451/gems/bundler-1.6.2/lib/bundler/definition.rb:178:in `specs_for'
Show 28 more lines

I am sure my rake is latest version

Gemfile

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'devise', '3.0.2'
gem "seo_helper", "~> 1.0.2"
gem "open_graph_helper"

gem "rmagick"
gem "carrierwave"
gem "carrierwave-meta"

gem "settingslogic"

gem "anjlab-bootstrap-rails", "2.3.1.2", :require => "bootstrap-rails"
gem "bootstrap_helper", ">= 4.2.2.1"
gem "simple_form", "~> 3.0.1" 
gem "will_paginate", "3.0.3"
gem "font-awesome-rails", "~> 3.2.1.3"

gem "high_voltage"

gem "airbrake"

gem "rvm-capistrano"
gem 'rake', '~> 10.3.2'
gem "omniauth"
gem "omniauth-facebook"
gem "auto-facebook", "0.42"


gem "whenever"

gem "hipchat"

# Cache
gem "dalli"

gem "compass-rails", "~> 1.1.2"

group :development do
  gem "capistrano"
  gem "capistrano-ext"
  gem "cape"
  gem "binding_of_caller"
  gem "better_errors", "~> 0.9.0"
  gem "magic_encoding"
  gem "annotate"
  gem "powder"
  gem "pry-nav"
  gem "pry-remote"
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.1.1)
      actionpack (= 4.1.1)
      actionview (= 4.1.1)
      mail (~> 2.5.4)
    actionpack (4.1.1)
      actionview (= 4.1.1)
      activesupport (= 4.1.1)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.1)
      activesupport (= 4.1.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.1)
      activesupport (= 4.1.1)
      builder (~> 3.1)
    activerecord (4.1.1)
      activemodel (= 4.1.1)
      activesupport (= 4.1.1)
      arel (~> 5.0.0)
    activesupport (4.1.1)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    airbrake (3.1.17)
      builder
      multi_json
    anjlab-bootstrap-rails (2.3.1.2)
      railties (>= 3.0)
      sass (>= 3.2)
    annotate (2.6.3)
      activerecord (>= 2.3.0)
      rake (>= 0.8.7)
    arel (5.0.1.20140414130214)
    auto-facebook (0.42)
      omniauth
      omniauth-facebook
      rails (>= 4.0.0)
    bcrypt (3.1.7)
    bcrypt-ruby (3.1.5)
      bcrypt (>= 3.1.3)
    better_errors (0.9.0)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap_helper (4.2.3)
      railties (>= 4.0.0)
      thor (~> 0.14)
      will_paginate (>= 3.0.3)
    builder (3.2.2)
    cape (1.8.0)
    capistrano (2.15.5)
      highline
      net-scp (>= 1.0.0)
      net-sftp (>= 2.0.0)
      net-ssh (>= 2.0.14)
      net-ssh-gateway (>= 1.1.0)
    capistrano-ext (1.2.1)
      capistrano (>= 1.0.0)
    carrierwave (0.10.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
      mime-types (>= 1.16)
    carrierwave-meta (0.0.5)
      activesupport (>= 3.0)
      carrierwave (>= 0.5.7)
      mime-types
    chronic (0.10.2)
    chunky_png (1.3.1)
    coderay (1.1.0)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.7.0)
    compass (0.12.6)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.2.19)
    compass-rails (1.1.7)
      compass (>= 0.12.2)
      sprockets (<= 2.11.0)
    dalli (2.7.2)
    debug_inspector (0.0.2)
    devise (3.0.2)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      warden (~> 1.2.3)
    erubis (2.7.0)
    execjs (2.0.2)
    faraday (0.9.0)
      multipart-post (>= 1.2, < 3)
    font-awesome-rails (3.2.1.3)
      railties (>= 3.2, < 5.0)
    fssm (0.2.10)
    hashie (2.1.1)
    high_voltage (2.1.0)
    highline (1.6.21)
    hike (1.2.3)
    hipchat (1.1.0)
      httparty
    httparty (0.13.1)
      json (~> 1.8)
      multi_xml (>= 0.5.2)
    i18n (0.6.9)
    jbuilder (2.0.7)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (3.1.0)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    jwt (0.1.13)
      multi_json (>= 1.5)
    magic_encoding (0.0.2)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.8.2)
    mime-types (1.25.1)
    minitest (5.3.4)
    multi_json (1.10.1)
    multi_xml (0.5.5)
    multipart-post (2.0.0)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-sftp (2.1.2)
      net-ssh (>= 2.6.5)
    net-ssh (2.9.1)
    net-ssh-gateway (1.2.0)
      net-ssh (>= 2.6.5)
    oauth2 (0.9.3)
      faraday (>= 0.8, < 0.10)
      jwt (~> 0.1.8)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (~> 1.2)
    omniauth (1.2.1)
      hashie (>= 1.2, < 3)
      rack (~> 1.0)
    omniauth-facebook (1.6.0)
      omniauth-oauth2 (~> 1.1)
    omniauth-oauth2 (1.1.2)
      faraday (>= 0.8, < 0.10)
      multi_json (~> 1.3)
      oauth2 (~> 0.9.3)
      omniauth (~> 1.2)
    open_graph_helper (0.2.0)
    orm_adapter (0.5.0)
    polyglot (0.3.4)
    powder (0.2.1)
      thor (>= 0.11.5)
    pry (0.9.12.6)
      coderay (~> 1.0)
      method_source (~> 0.8)
      slop (~> 3.4)
    pry-nav (0.2.3)
      pry (~> 0.9.10)
    pry-remote (0.1.8)
      pry (~> 0.9)
      slop (~> 3.0)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.1.1)
      actionmailer (= 4.1.1)
      actionpack (= 4.1.1)
      actionview (= 4.1.1)
      activemodel (= 4.1.1)
      activerecord (= 4.1.1)
      activesupport (= 4.1.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.1)
      sprockets-rails (~> 2.0)
    railties (4.1.1)
      actionpack (= 4.1.1)
      activesupport (= 4.1.1)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.3.2)
    rdoc (4.1.1)
      json (~> 1.4)
    rmagick (2.13.2)
    rvm-capistrano (1.5.1)
      capistrano (~> 2.15.4)
    sass (3.2.19)
    sass-rails (4.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.0)
      sprockets (~> 2.8, <= 2.11.0)
      sprockets-rails (~> 2.0)
    sdoc (0.4.0)
      json (~> 1.8)
      rdoc (~> 4.0, < 5.0)
    seo_helper (1.0.2)
    settingslogic (2.0.9)
    simple_form (3.0.2)
      actionpack (~> 4.0)
      activemodel (~> 4.0)
    slop (3.5.0)
    spring (1.1.3)
    sprockets (2.11.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.1.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    sqlite3 (1.3.9)
    thor (0.19.1)
    thread_safe (0.3.3)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (2.2.2)
      coffee-rails
    tzinfo (1.1.0)
      thread_safe (~> 0.1)
    uglifier (2.5.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    warden (1.2.3)
      rack (>= 1.0)
    whenever (0.9.2)
      activesupport (>= 2.3.4)
      chronic (>= 0.6.3)
    will_paginate (3.0.3)

PLATFORMS
  ruby

DEPENDENCIES
  airbrake
  anjlab-bootstrap-rails (= 2.3.1.2)
  annotate
  auto-facebook (= 0.42)
  better_errors (~> 0.9.0)
  binding_of_caller
  bootstrap_helper (>= 4.2.2.1)
  cape
  capistrano
  capistrano-ext
  carrierwave
  carrierwave-meta
  coffee-rails (~> 4.0.0)
  compass-rails (~> 1.1.2)
  dalli
  devise (= 3.0.2)
  font-awesome-rails (~> 3.2.1.3)
  high_voltage
  hipchat
  jbuilder (~> 2.0)
  jquery-rails
  magic_encoding
  omniauth
  omniauth-facebook
  open_graph_helper
  powder
  pry-nav
  pry-remote
  rails (= 4.1.1)
  rmagick
  rvm-capistrano
  sass-rails (~> 4.0.3)
  sdoc (~> 0.4.0)
  seo_helper (~> 1.0.2)
  settingslogic
  simple_form (~> 3.0.1)
  spring
  sqlite3
  turbolinks
  uglifier (>= 1.3.0)
  whenever
  will_paginate (= 3.0.3)

I tried bundle install rake and bundle update but it still doesn't work. Thanks for all the help.

AshNaz87
  • 376
  • 3
  • 14
user3649246
  • 1,011
  • 1
  • 7
  • 8

11 Answers11

171
bundle config set --local path 'vendor/cache'

generally fixes it as that is the more common problem. Basically, your bundler path configuration is messed up. See their documentation (first paragraph) for where to find those configurations and change them manually if needed.

P.S. If the documentation link is not accessible it might be related to the bundler version, in that case you can move to main page and search the topic instead e.g. bundle-config from https://bundler.io/v2.4/man/bundle-config.1.html

Prabin Poudel
  • 244
  • 3
  • 15
Benjamin Harel
  • 2,906
  • 3
  • 24
  • 32
  • 35
    This could definitely be improved by providing a reason why this works, and, more specifically, what it does. – jwir3 Dec 11 '15 at 02:02
  • 1
    Now i am able to debug in rubymine :) – Vipin Verma Mar 01 '16 at 07:16
  • 4
    I think the real command to run is `bundle install --no-deployment` - thanks to this message from Bundler when I deleted Gemfile.lock: "If this is a development machine, remove the Gemfile freeze by running `bundle install --no-deployment`." – benpickles Jun 02 '16 at 14:42
  • 2
    The command is marked as deprecated. However, you can still run `bundle config set path 'vendor/cache'`. "[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/cache'`, and stop using this flag" – fnandogp Jun 10 '20 at 05:45
  • 2
    In case you're coming across this as of late, the selected answer is still accurate, however you will now get this warning from bundler: ``` [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/cache' ``` Just a friendly FYI. – calicanadian Aug 17 '20 at 15:09
  • 1
    If you edit `BUNDLE_PATH` variable, like I done in my Dockerfile, you need to put this url in `--path` argument. Also, to see what is your bundle path, you can use `bundle env`. – Jonatas Eduardo Dec 17 '20 at 22:34
  • The `--path` option is deprecated. – Edison Pebojot Aug 10 '21 at 01:13
  • 1
    The link given in the answer is dead... someone could update it please? – MDickten Aug 29 '22 at 08:59
25

I solved that deleting the Gemfile.lock

jri2594
  • 363
  • 3
  • 3
  • 38
    This is bad advice, do not do this. Your Gemfile.lock holds a lot of important version constraints that should not be wiped out globally without strict scrutiny. Most people don't specify tight versions in their Gemfile so you may end up bumping the versions of a lot of gems all at once by doing this: baby -> bathwater. – Olivier Lacan Dec 18 '19 at 15:52
  • somehow it worked for me :p – Abhishek Thapliyal Mar 22 '22 at 12:04
  • 2
    Worked for me. In my case I've moved to a new m1 mac and Gemfile.lock was used on Intel mac. After removing Gemfile.lock and running script again, .lock file was regenerated and just few lines were updated including platform changed from "ruby" to "arm64-darwin-21". So if you don't have specific versions like mentioned above, it's safe to remove it but keep an eye on what will be updated. – smartwolf Apr 21 '22 at 13:56
19

I think rake must be preinstalled if you want work with bundler. Try to install rake via 'gem install' and then run 'bundle install' again:

gem install rake && bundle install

If you are using rvm ( http://rvm.io ) rake is installed by default...

Eddie
  • 496
  • 5
  • 8
  • The web server user is `www-data` but user with `rbenv` and `ruby` installed is `deploy`. So I am gettings an error that the gem is missing. Using Apache with mod_passenger – tread Oct 03 '14 at 18:17
3

If you're having this issue, and try to run bundle exec jekyll serve per this Jekyll documentation, it'll ask you to run bundle install, which should prompt you to install any missing gems, which in this case will be rake. This should resolve your issue.

You may also need to run bundle update to ensure Gemfile.lock is referencing the most up-to-date gems.

mumush
  • 650
  • 6
  • 14
3

Bundler 2

If you need to update from bundler v1 to v2 follow this official guide.

For a fast solution:

  1. In root of your application run bundle config set path "/bundle" to add a custom path for bundler use, in this case I set /bundle, you can use whatever.

    1.2 [Alternative solution] You can use a bundler file (~/.bundle/config) also, to use this I recommend set bundler folders in environment, like a Docker image, for example. Here the official guide.

  2. You don't need to delete your Gemfile.lock, It's a bad practice and this can cause other future problems. Commit Gemfile.lock normaly, sometimes you need to update your bundle with bundle install or install individual gem.

You can see all the configs for bundler version 2 here.

Jonatas Eduardo
  • 834
  • 9
  • 18
1

My colleague told me that it can solved by disabling spring. For docker users:

docker exec -ite DISABLE_SPRING=1 [container_name] rails c
Salma Gomaa
  • 952
  • 1
  • 13
  • 18
0

Remove your Gemfile.lock.

Move to bash if you are using zsh.

sudo bash
gem update --system 

Now run command bundle to create a new Gemfile.lock file. Move back to your zsh sudo exec zsh now run your rake commands.

Touseef Murtaza
  • 1,548
  • 14
  • 20
0

**

bundle install --no-deployment

**

$ jekyll help

jekyll 4.0.0 -- Jekyll is a blog-aware, static site generator in Ruby

knows1
  • 1
  • 2
0

In my case, my problem was environmental. Meaning, I did something wrong in my bash session. After attempting nearly everything in this thread, I opened a new bash session and everything was back to normal.

DaveWoodall.com
  • 727
  • 6
  • 22
0

I solved the simmilar problem, when i tried to push to repo via gitlab ci/cd pipeline by the command "gem install rake && bundle install"

aleksandr
  • 11
  • 1
0

Regarding knows1's answer:

In Rails ~> 6.0.0 it complains:

[DEPRECATED] The --no-deployment flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use bundle config set --local deployment 'false', and stop using this flag