Rails控制台不工作(搜索错误的gem)



我的Rails控制台停止工作:

$ rails c
Could not find rake-10.2.2 in any of the sources
Run `bundle install` to install missing gems.

你可能认为运行bundle installbundle update会起作用,但没有!让我困惑的是,我没有使用rake 10.2.2,它也不在gemfile.lock中。我使用的是rake 10.3.2

通过bundle exec rails console RAILS_ENV=development运行返回相同的错误。

尝试gem install rake -v 10.2.2只是稍微改善了情况。现在它正在寻找一个我没有使用的不同宝石:

$ rails c
Could not find i18n-0.6.9 in any of the sources
Run `bundle install` to install missing gems.

再次。。。捆绑安装很好。更奇怪的是,rails s工作得很好,rake任务也很好。我就是不能用控制台!

$ bundle install
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.2
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.6
Using mime-types 2.3
Using mail 2.6.1
Using actionmailer 4.1.6
Using arbre 1.0.2
Using sass 3.2.19
Using thor 0.19.1
Using bourbon 3.2.3
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using railties 4.1.6
Using coffee-rails 4.0.1
Using formtastic 3.0.0
Using has_scope 0.6.0.rc
Using responders 1.0.0
Using inherited_resources 1.4.1
Using jquery-rails 3.1.2
Using jquery-ui-rails 5.0.0
Using kaminari 0.16.1
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6
Using bundler 1.7.3
Using hike 1.2.3
Using multi_json 1.10.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using rails 4.1.6
Using polyamorous 1.1.0
Using ransack 1.4.1
Using sass-rails 4.0.3
Using activeadmin 1.0.0.pre from git://github.com/activeadmin/activeadmin.git (at master)
Using addressable 2.3.6
Using bcrypt 3.1.7
Using bootstrap-sass 3.2.0.2
Using mini_portile 0.6.0
Using nokogiri 1.6.3.1
Using xpath 2.0.0
Using capybara 2.4.3
Using timers 1.1.0
Using celluloid 0.15.2
Using coderay 1.1.0
Using database_cleaner 1.3.0
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 3.3.0
Using diff-lcs 1.2.5
Using launchy 2.4.2
Using email_spec 1.6.0
Using excon 0.39.6
Using factory_girl 4.4.0
Using factory_girl_rails 4.4.1
Using ffi 1.9.5
Using figaro 1.0.0
Using formatador 0.2.5
Using friendly_id 5.0.4
Using multi_xml 0.5.5
Using httparty 0.13.1
Using gibbon 1.0.4
Using rb-fsevent 0.9.4
Using rb-inotify 0.9.5
Using listen 2.7.11
Using lumberjack 1.0.9
Using method_source 0.8.2
Using slop 3.6.0
Using pry 0.10.1
Using guard 2.6.1
Using rspec-support 3.1.1
Using rspec-core 3.1.4
Using rspec-expectations 3.1.2
Using rspec-mocks 3.1.2
Using rspec 3.1.0
Using guard-rspec 4.3.1
Using haml 4.0.5
Using haml-rails 0.5.3
Using heroku-api 0.3.19
Using heroku_san 4.3.2
Using jbuilder 1.5.3
Using turbolinks 2.3.0
Using jquery-turbolinks 2.1.0
Using netrc 0.7.7
Using newrelic_rpm 3.9.4.245
Using pg 0.17.0
Using rails_serve_static_assets 0.0.2
Using rails_stdout_logging 0.0.3
Using rails_12factor 0.0.2
Using recaptcha 0.3.6
Using rest-client 1.7.2
Using rspec-rails 3.1.0
Using shoulda-matchers 2.7.0 from git://github.com/thoughtbot/shoulda-matchers.git (at master)
Using spring 1.1.3
Using spring-commands-rspec 1.0.2
Using sqlite3 1.3.8
Using streak_client 0.0.0 from git://github.com/yetanothernguyen/streak_client.git (at master)
Using sucker_punch 1.2.1
Using uglifier 2.5.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

通过Twitter向我建议的答案有效:

步骤1)删除gemset并重新安装

这并没有让我跑起来,但它至少让控制台与正确的宝石组对话。但控制台仍然挂着。

中断控制台显示弹簧出现错误。

这个问题建议我停止弹簧:加载时悬挂在轨道上的控制台上的红宝石

bin/spring stop

一切正常!

运行此

bundle exec rails console RAILS_ENV=development

最新更新