Bundler cannot find rake but it seems installed

2019-05-13 16:34发布

I am having some struggles with bundler and rake. According to the error message, bundler can't find rake-10.3.1. Here's the thing, everything I've done seems to indicate that rake-10.3.1 is installed. I've been floating in the google-sphere for days without finding a solution that resolves this issue for me.

I'm on Mac OSX 10.8.5. Ruby version is 1.9.3-p392.

Error:

bundle exec rspec spec/bdr_pre_dev_spec.rb

/Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92:in `materialize': Could not find rake-10.3.1 in any of the sources (Bundler::GemNotFound)
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `map!'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `materialize'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/definition.rb:133:in `specs'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/definition.rb:178:in `specs_for'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/definition.rb:167:in `requested_specs'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/environment.rb:18:in `requested_specs'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:13:in `setup'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler.rb:120:in `setup'
  from /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.6.2/lib/bundler/setup.rb:17

Here are things I've done:

  • Blasted away the Gemfile.lock and tried a bundle install. This reinstalls gems and clearly shows rake-10.3.1 being installed but when I run rspec it still says it can't find rake.
  • Manually try to install gem with gem install rake -v 10.3.1 which also indicates that rake-10.3.1 is installed but rspec command still throws the same error.
  • Explicitly specified rake 10.3.1 in the Gemfile, blasted away Gemfile.lock and bundle install
  • Uninstall rake (all versions found) gem uninstall rake and reinstall rake using gem install rake -v 10.3.1
  • Uninstalled the version of ruby I was using and reinstalled it with rvm uninstall ruby-1.9.3-p392 and then rvm install ruby-1.9.3-p392.
  • Downgrade bundler to 1.6.1
  • Uninstall and reinstall bundler
  • rvm implode and reinstall rvm

None of these fixed the issue.

bundle show says that rake-10.3.1 is installed.

Gems included by the bundle:
* activemodel (3.2.18)
* activesupport (3.2.18)
* amq-protocol (1.9.2)
* amqp (1.3.0)
* awesome_print (1.2.0)
* bertha-scheduler (1.1.9)
* bertha_client (0.5.5)
* builder (3.0.4)
* bundler (1.6.2)
* coderay (1.1.0)
* config_client (0.3.2)
* config_core (1.0.2)
* dao_core (2.6.3)
* diff-lcs (1.2.5)
* effin_utf8 (1.0)
* eventmachine (1.0.3)
* faraday (0.8.9)
* faraday_middleware (0.9.1)
* hashie (2.0.5)
* highline (1.6.21)
* httparty (0.11.0)
* i18n (0.6.9)
* method_source (0.8.2)
* multi_json (1.8.4)
* multi_xml (0.5.5)
* multipart-post (1.2.0)
* mysql2 (0.3.15)
* net-scp (1.2.1)
* net-sftp (2.1.2)
* net-ssh (2.9.0)
* nexus (1.2.1)
* opower-rake-tasks (0.0.2)
* outbound_client (0.0.5)
* pry (0.9.12.6)
* rabbitmq_http_api_client (1.1.0)
* rake (10.3.1)
* rspec (2.14.1)
* rspec-core (2.14.8)
* rspec-expectations (2.14.5)
* rspec-mocks (2.14.6)
* sequel (4.10.0)
* slop (3.5.0)
* term-ansicolor (1.3.0)
* thor (0.19.1)
* tins (1.1.0)
* tools_core (1.3.0)
* utility_configs (1.0.4)

I've checked the .rvm directory for the presence of the rake-10.3.1 gem and it's there.

    ls /Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/gems
    total 0
    drwxrwxr-x  10 dru.solis  staff  340 May  9 23:22 .
    drwxrwxr-x  11 dru.solis  staff  374 May  9 23:16 ..
    drwxr-xr-x  18 dru.solis  staff  612 May  9 23:17 bundler-1.6.2
    drwxr-xr-x   8 dru.solis  staff  272 May  9 23:16 bundler-unload-1.0.2
    drwxr-xr-x  12 dru.solis  staff  408 May  9 23:16 executable-hooks-1.3.1
    drwxr-xr-x  13 dru.solis  staff  442 May  9 23:16 gem-wrappers-1.2.4
    drwxr-xr-x  16 dru.solis  staff  544 May  9 23:20 rake-10.3.1
    drwxr-xr-x   3 dru.solis  staff  102 May  9 23:16 rdoc-3.9.5
    drwxr-xr-x  13 dru.solis  staff  442 May  9 23:16 rubygems-bundler-1.4.3
    drwxr-xr-x   7 dru.solis  staff  238 May  9 23:17 rvm-1.11.3.9

Output of rvm env:

export PATH="/Users/dru.solis/.rvm/gems/ruby-1.9.3-p392/bin:/Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global/bin:/Users/dru.solis/.rvm/rubies/ruby-1.9.3-p392/bin:$PATH"
export GEM_HOME='/Users/dru.solis/.rvm/gems/ruby-1.9.3-p392'
export GEM_PATH='/Users/dru.solis/.rvm/gems/ruby-1.9.3-p392:/Users/dru.solis/.rvm/gems/ruby-1.9.3-p392@global'
export MY_RUBY_HOME='/Users/dru.solis/.rvm/rubies/ruby-1.9.3-p392'
export IRBRC='/Users/dru.solis/.rvm/rubies/ruby-1.9.3-p392/.irbrc'
unset MAGLEV_HOME
unset RBXOPT

1条回答
三岁会撩人
2楼-- · 2019-05-13 17:33

So, I finally managed to get this error to go away. I started thinking it was some weird permission issue.

To solve this problem, I did the following:

  • Open the Disk Utility, Applications/Utilities/Disk Utility
  • Repair Permissions
  • Remove the .bundle directory in my project
  • Remove the vendor directory in my project
  • Remove the Gemfile.lock
  • bundle install

After that it started working without complaining about not finding rake. Crazy, man. Ugh. Hopefully this helps other folks if they run into the same issue.

查看更多
登录 后发表回答