简体   繁体   中英

`require': cannot load such file — rack-webconsole (LoadError)

I just upgraded to Yosemite and I have a Rails 3.2.18 app running on this local machine. It was running fine (eg rails s worked, rails c worked, etc.) but after cleaning up rvm and re-bundling, I get this error when running rails c or rails s :

/Users/cweilemann/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `require': cannot load such file -- rack-webconsole (LoadError)
    from /Users/cweilemann/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/cweilemann/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `each'
    from /Users/cweilemann/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/cweilemann/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `each'
    from /Users/cweilemann/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `require'
    from /Users/cweilemann/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.1/lib/bundler.rb:132:in `require'
    from /Users/cweilemann/Projects/railsapp/config/application.rb:7:in `<top (required)>'

Line 7 of config/application.rb is:

Bundler.require(*Rails.groups(:assets => %w(development test)))

In my Gemfile, I have:

group :development do
  ...
  gem 'rack-webconsole-pry', :require => 'rack-webconsole'
  ...
end

If I move the gem 'rack-webconsole-pry', :require => 'rack-webconsole' line outside of the group :development , the app loads just fine. If I remove the :require => 'rack-webconsole' , the app loads just fine.

Is this a bundler issue? Or an issue with Rails and Yosemite?

Update

gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 2.2.2
  - RUBY VERSION: 2.1.1 (2014-02-24 patchlevel 76) [x86_64-darwin12.0]
  - INSTALLATION DIRECTORY: /Users/cweilemann/.rvm/gems/ruby-2.1.1@railsapp
  - RUBY EXECUTABLE: /Users/cweilemann/.rvm/rubies/ruby-2.1.1/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/cweilemann/.rvm/gems/ruby-2.1.1@railsapp/bin
  - SPEC CACHE DIRECTORY: /Users/cweilemann/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-12
  - GEM PATHS:
     - /Users/cweilemann/.rvm/gems/ruby-2.1.1@railsapp
     - /Users/cweilemann/.rvm/gems/ruby-2.1.1@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/cweilemann/.rvm/gems/ruby-2.1.1@railsapp/bin
     - /Users/cweilemann/.rvm/gems/ruby-2.1.1@global/bin
     - /Users/cweilemann/.rvm/rubies/ruby-2.1.1/bin
     - /Users/cweilemann/.rvm/bin
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin

When I do: bundle env

I get:

Bundler 1.6.1
Ruby 2.1.1 (2014-02-24 patchlevel 76) [x86_64-darwin12.0]
Rubygems 2.2.2
rvm 1.26.0 (latest)
GEM_HOME /Users/cweilemann/.rvm/gems/ruby-2.1.1@railsapp
GEM_PATH /Users/cweilemann/.rvm/gems/ruby-2.1.1@railsapp:/Users/cweilemann/.rvm/gems/ruby-2.1.1@global
rubygems-bundler (1.4.3)

Bundler settings
  without
    Set for your local app (/Users/cweilemann/Projects/railsapp/.bundle/config): "test:development"


Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.18'
gem 'rubyzip', '~>0.9.9'
gem 'pg'

...
...

group :development do
  gem "quiet_assets", ">= 1.0.1"
  gem "better_errors", ">= 0.3.2"
  gem "binding_of_caller", "~> 0.7.2"
  gem 'annotate' #puts comments in models/tests with db fields for a given domain
  gem 'debugger', "~> 1.6.6"
  gem 'rack-webconsole-pry', :require => 'rack-webconsole' #default activated by backtick.  may need rake patch task from this project's /lib/tasks
  gem 'foreman' #support to start multiple processes at once (server, resque workers, etc.)
  gem 'rails-erd' #generate ERD for domains. may require separate graphviz binary installation.
  #functional, but not commonly used
end

group :test, :development do
  gem 'rspec-rails', '~> 2.0'
  gem 'poltergeist'                         # See https://github.com/jonleighton/poltergeist for how to install phantomjs
  gem 'capybara'
  gem 'launchy'
  gem "api_matchers"
  gem "shoulda-matchers", ">= 2.6.2", require: false
  gem 'machinist', '~> 2.0'
  gem "guard", "~> 1.6.2"
  gem "spork", "~> 0.9.2"
  gem "guard-rspec", "~> 2.5.1"
  gem "guard-spork", "~> 1.4.0"
  gem 'rb-fsevent', "~> 0.9.4"
  gem 'rb-readline', "~> 0.5.1"
  gem "simplecov", "~> 0.7.1", :require => false
  gem 'puma'
  gem 'sql_queries_count'
end


Gemfile.lock

GIT
  remote: https://github.com/jwhitley/requirejs-rails.git
  revision: f2330104aeca4d193fd5680a22ae7eee85d814b5
  specs:
    requirejs-rails (0.9.1)
      railties (>= 3.1.1, < 4.1)

GEM
  remote: https://rubygems.org/
  specs:

    ...
    ...

    rack-webconsole-pry (0.1.9)
      json
      multi_json (>= 1.0.3)
      pry
      rack
    rails (3.2.18)
      actionmailer (= 3.2.18)
      actionpack (= 3.2.18)
      activerecord (= 3.2.18)
      activeresource (= 3.2.18)
      activesupport (= 3.2.18)
      bundler (~> 1.0)
      railties (= 3.2.18)
    ...
    ...


PLATFORMS
  ruby

DEPENDENCIES
  ...
  ...

  rack-webconsole-pry
  rails (= 3.2.18)
  ...

Note: I've edited the bundle env list for security purposes as this is a production application.

When I do: bundle show --paths rack-webconsole-pry

I get:

Could not find gem 'rack-webconsole-pry'.
Did you mean rack-webconsole-pry?

The output you have from bundle env shows this:

Bundler settings
  without
    Set for your local app (/Users/cweilemann/Projects/railsapp/.bundle/config): "test:development"

This means that bundle install will skip installing anything in your development group (and test as well).

Remove that line from your .bundle/config file and run bundle install again, and it should start working.

This appears to be an issue with rack-webconsole-pry .

Here's the Gemfile:

source "https://rubygems.org"

group :development do
  gem 'rack-webconsole-pry', :require => 'rack-webconsole'
end

Here's installing those gems into Rubygems system gems with no gemsets, and everything working:

$ bundle install --system
Using coderay 1.1.0
Using multi_json 1.10.1
Using method_source 0.8.2
Using json 1.8.1
Using rack 1.5.2
Using bundler 1.7.5
Using slop 3.6.0
Using pry 0.10.1
Using rack-webconsole-pry 0.1.9
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ bundle check
The Gemfile's dependencies are satisfied
$ bundle exec bundle check
The Gemfile's dependencies are satisfied

Here's me installing those gems into a path instead of into system gems, and everything breaking horribly:

$ bundle install --path gems
Fetching gem metadata from https://rubygems.org/..........
Using bundler 1.7.5
Installing method_source 0.8.2
Installing slop 3.6.0
Installing coderay 1.1.0
Installing rack 1.5.2
Installing multi_json 1.10.1
Installing pry 0.10.1
Installing json 1.8.1
Installing rack-webconsole-pry 0.1.9
Your bundle is complete!
It was installed into ./gems

$ bundle check
The Gemfile's dependencies are satisfied

$ bundle exec bundle check
Could not find coderay-1.1.0 in any of the sources
Run `bundle install` to install missing gems.

When it is loaded, rack-webconsole-pry is somehow doing something that breaks the way gems are loaded, making it impossible to load gems after that. When you move it out of the development group, it doesn't get required, and so things are fine. When you put it in the development group, it gets loaded, but then breaks the way gems are loaded, and then it's no longer possible to find gems that are actually installed to load them after that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM