2016-03-07 121 views
1

我使用Ubuntu 14.04和我使用Ruby on Rails的初学者轨服务器的bin /导轨:6:警告:已初始化常数APP_PATH错误

我最近安装rbenv,红宝石2.3.0和4.2导轨.4以下教程:https://gorails.com/setup/ubuntu/14.04

安装后,我运行了ruby -v和rails -v并获得了预期的版本。到现在为止还挺好。然后我跑rails s和我:

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

要解决它,我跑: rake rails:update:bin以下这个StackOverflow的问题:rails server bin/rails:6: warning: already initialized constant APP_PATH error导致一个新的错误(我也删除春宝石):

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) 

我预先安装'bundle exec',并得到以下错误:

/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>' 

在安装rbenv之前,我使用了RVM我也有同样的错误。当我开始遇到这些问题时,我无法弄清楚我所做的改变。

为了我的理智,任何帮助都非常感谢!

谢谢大家!

+0

您是否尝试过输入您的bash配置文件? 'source〜/ .bash_profile' – bntzio

回答

3

我的一个朋友刚刚帮我解决了这个问题。 什么他建议:

  1. 创建文件.ruby版本在我的项目目录有一行:红宝石2.3.0 - 这将确保我们不会加载另一个版本引入nokogiri
  2. 删除捆绑运行:RM -rfv .bundle
  3. 然后运行:束
  4. 运行:束EXEC轨小号

就像一个魅力。 我问他为什么他认为我有这些问题,并说:很难说,一个乱七八糟的.bundle目录可以做很多时髦的东西。

相关问题