2017-01-27 19 views
0

私は昨夜完全に動作していたRailsサーバを持っていました。しかし、今朝コンピュータにアクセスすると、クラッシュしていたことが分かりました。私はその後、私のリモートサーバーにSSHed、バック起動し、サーバー・プロセスを再起動しようとしましたが、最初の問合せ:Ruby on Rails:ラック/ハンドラをロードできません/

rails server -h 

をもたらした:

/usr/local/lib/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem railties (>= 0.a) (Gem::GemNotFoundException) 
from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path' 
from /usr/local/bin/rails:22:in `<main>' 

私はその後、投げbundle installを試み次のエラー:

enter code here/usr/local/lib/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) 
from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path' 
from /usr/local/bin/bundle:22:in `<main>' 

私はその後、gem install rails続いrvm use [email protected] --createでのRailsを再インストールしました。 rails -vは現在報告されます。

Rails 5.0.1 

をしかし、私は、サーバー・プロセス(rails server -p 80 - b 139.162.246.138)を起動しようとしたときに私が取得:

Exiting 
/home/peter/.rvm/gems/[email protected]/gems/rack-2.0.1/lib/rack/handler.rb:74:in `require': cannot load such file -- rack/handler/- (LoadError) 
    from /home/peter/.rvm/gems/[email protected]/gems/rack-2.0.1/lib/rack/handler.rb:74:in `try_require' 
    from /home/peter/.rvm/gems/[email protected]/gems/rack-2.0.1/lib/rack/handler.rb:16:in `get' 
    from /home/peter/.rvm/gems/[email protected]/gems/rack-2.0.1/lib/rack/server.rb:300:in `server' 
    from /home/peter/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/commands/server.rb:112:in `print_boot_information' 
    from /home/peter/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/commands/server.rb:73:in `start' 
    from /home/peter/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server' 
    from /home/peter/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap' 
    from /home/peter/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `server' 
    from /home/peter/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' 
    from /home/peter/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

私はルビーやレールの両方をアンインストールして再インストールしてみました、そして新しいbundle installを実行しています。

gem uninstall rails -v 5.0.1 
gem uninstall railties -v 5.0.1 
gem install rails -v 5.0.1 
gen install railties -v 5.0.1 

同じエラー:私もと完全にアンインストールレールとrailtiesを試してみました

/home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated 
/home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated 
Exiting 
/home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/rack-2.0.1/lib/rack/handler.rb:74:in `require': cannot load such file -- rack/handler/- (LoadError) 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/rack-2.0.1/lib/rack/handler.rb:74:in `try_require' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/rack-2.0.1/lib/rack/handler.rb:16:in `get' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/rack-2.0.1/lib/rack/server.rb:300:in `server' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/railties-5.0.1/lib/rails/commands/server.rb:112:in `print_boot_information' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/railties-5.0.1/lib/rails/commands/server.rb:73:in `start' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `server' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' 
    from /home/peter/.rvm/gems/ruby-2.4.0-rc1/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

:基本的には同じエラーを得ていません。で、問題のコールを見つけるためにしようとしました

:ソースディレクトリから

sudo grep -rnw './' -e "/var/lib/gems/2.3.0/" 

は、コンソールには何も出力しません。

内のすべての宝石結果を削除する sudo gem uninstall --allを実行
cd /var/lib/gems/ 
-bash: /home/peter/.rvm/scripts/initialize: No such file or directory 
-bash: /home/peter/.rvm/scripts/hook: No such file or directory 

::前レール-5.0.1宝石の除去が

You have requested to uninstall the gem: 
    actioncable-5.0.1 

rails-5.0.1 depends on actioncable (= 5.0.1) 
If you remove this gem, these dependencies will not be met. 
Continue with Uninstall? [yN] ERROR: While executing gem ... (Gem::DependencyRemovalException) 
    Uninstallation aborted due to dependent gem(s) 

にエラーメッセージが結果にリストされているディレクトリにアクセスしようとすると

コマンドを実行するとこれが修正されました...しかし、すべての宝石を削除するはずのこのコマンドを実行した後、rails -v

Rails 4.2.7.1 

gem uninstall rails-4.2.7.1を実行しても、このバージョンは削除されません。

ERROR: While executing gem ... (Gem::Requirement::BadRequirementError) 
Illformed requirement ["rails-4.2.7.1"] 

アップデート:中

gem uninstall -v rails-4.2.7.1結果は最終的にレールとルビーを削除することができました。それらを再インストールしました。同じ問題。

rew railsプロジェクトを作成しようとしましたが、新しいプロジェクトはまったく同じことを行います。

答えて

1

それでも問題は解決しました。私が入力した:

rails server -p 80 - b 139.162.246.138 

の代わりに:

rails server -p 80 -b 139.162.246.138 
+0

私はちょうど私が同じタイプミスをしていたことに気づいた。 –

0

=> rbenvを使用して宝石をインストールした後に再ハッシュしましたか?=> gemfileをチェックしておかないと、rubyのバージョンが一致していることを確認してください。=> gemfile.lock(作業中のディレクトリにあります)

+0

を、私は少しの間でそれを試してみましょう。 Atm私は新鮮なものから始めるために私のシステムからRubyとRailsの最後のトレースを取得しようとしています。 –

+0

OK醸造でそれを試してみると、10,000回のシンプルな生活をするが、宝石をインストールした後にrhenvを使って再ハッシュをする。 – Boschko

+0

公正であるために、いったんそれを変更していなければ、ワーキング。しかし、それは窓から出ています:p。私はPC上でUbuntuを実行しているので、私は自家製のものを使うことはできないと思う。 –

関連する問題