我无法执行rails console

时间:2015-12-29 19:18:10

标签: ruby-on-rails

我收到错误我不知道如何修复它。

$ rails console
/Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
    from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:33:in `<module:Spring>'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:4:in `<top (required)>'
    from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:77:in `preload'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:143:in `serve'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:131:in `block in run'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `loop'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `run'
    from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'


$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]

$ rails -v
Rails 4.2.5

$ rvm current
ruby-2.2.3

$ irb
2.3.0 :001 > 

我可以使用rails s启动服务器并且该应用正常运行。我能够在Heroku上部署,我可以执行rails dbconsole

1 个答案:

答案 0 :(得分:0)

  1. 将捆绑包从1.11.x降级为1.10.2
  2. 从〜和所有rails项目的任何主文件夹(多个)
  3. 中删除了.bundler文件夹
  4. 从任何rails项目的主文件夹执行命令:bundle install --system
  5. 问题解决了。