Rails server bin / rails: 6: warning: APP_PATH already initialized persistent error

I am using Ubuntu 14.04 and I am starting to use Ruby on Rails

I recently installed rbenv, ruby โ€‹โ€‹2.3.0 and rails 4.2.4 after the tutorial: https://gorails.com/setup/ubuntu/14.04

After installation, I ran ruby โ€‹โ€‹-v and rails -v and got the expected versions. So far, so good. Then I ran rails s and I got:

 rails server bin/rails:6: warning: already initialized constant APP_PATH error 

To fix this, I ran: rake rails:update:bin after this question StackOverflow: rails server bin / rails: 6: warning: APP_PATH already initialized permanent error , which led to a new error (I also removed Spring gem):

 Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this. /my-home-directory/my-ruby-on-rails-project/config/boot.rb:3:in `<top (required)>' /my-home-directory/my-ruby-on-rails-project/config/application.rb:1:in `<top (required)>' /my-home-directory/my-ruby-on-rails-project/Rakefile:4:in `<top (required)>' LoadError: cannot load such file -- bundler/setup /my-home-directory/my-ruby-on-rails-project/config/boot.rb:3:in `<top (required)>' /my-home-directory/my-ruby-on-rails-project/config/application.rb:1:in `<top (required)>' /my-home-directory/my-ruby-on-rails-project/Rakefile:4:in `<top (required)>' (See full trace by running task with --trace) 

I prepend 'bundle exec' and got the following error:

 /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:29:in `require': libruby.so.2.2: cannot open shared object file: No such file or directory - /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri/nokogiri.so (LoadError) from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:29:in `rescue in <top (required)>' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:25:in `<top (required)>' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog/xml.rb:1:in `require' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog/xml.rb:1:in `<top (required)>' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog.rb:11:in `require' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog.rb:11:in `<top (required)>' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `require' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `<top (required)>' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `require' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `<top (required)>' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `require' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `<top (required)>' from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require' from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require' from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each' from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require' from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each' from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require' from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require' from /my-home-directory/my-ruby-on-rails-project/config/application.rb:7:in `<top (required)>' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `require' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `block in server' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!' from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>' from bin/rails:8:in `require' from bin/rails:8:in `<main>' 

Before installing rbenv, I used RVM and I got the same errors. I canโ€™t understand what changes I made when I had these problems.

For the sake of my sanity, any help is greatly appreciated!

Thanks everyone!

+1
ruby-on-rails ubuntu bundler
Mar 07 '16 at 18:19
source share
1 answer

A friend of mine helped me and fixed it. What he suggested:

  • Create a .ruby-version file in my project directory with one line: ruby-2.3.0. This will make sure that we are not downloading another version of nokogiri
  • Remove the bundle by running: rm -rfv.bundle
  • Then run: bundle
  • Run: bundle exec rails s

It works like a charm. I asked him why he thinks I have these problems, and said: "It's hard to say that a damaged .bundle directory can do a lot of funky things.

+3
Mar 07 '16 at 18:48
source share



All Articles