Search code examples
ruby-on-railsrubyshellrbenv

rbenv gives me to long error report in shell when something happens with my rails app


rbenv gives me to long error report in shell when something happens with my rails app in development. I don't need this. How can I disable it?

Example:

Exiting
/home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters
/connection_specification.rb:177:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_handling.rb:50:in `establish_connection'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/lazy_load_hooks.rb:27:in `each'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `run'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application.rb:352:in `initialize!'
    from /home/kirill/Projects/kirill-zhuravlov-blog/config/environment.rb:5:in `<top (required)>'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
    from /home/kirill/Projects/kirill-zhuravlov-blog/config.ru:3:in `block in <main>'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from /home/kirill/Projects/kirill-zhuravlov-blog/config.ru:in `new'
    from /home/kirill/Projects/kirill-zhuravlov-blog/config.ru:in `<main>'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/server.rb:61:in `app'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/server.rb:139:in `log_to_stdout'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/server.rb:78:in `start'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/kirill/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

But the actual problem is just my commented " #gem 'pg' " in gemfile. Im using latest LTS Ubuntu, ruby 2.3 and rails 4.2


Solution

  • I found solution to this issue. I open bashrc(shell startup configuration file) in terminal

    nano ~/.bashrc
    

    and cut

    export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
    export PATH="$HOME/.rbenv/bin:$PATH"
    

    then I save changes and exit (ctrl+O enter ctrl+X). And the long output is gone.