2013-06-19 158 views
0

我努力讓我的Rails服務器啓動。Rails服務器無法加載

我在Ubuntu 12.04上使用Rails 3.2.13,Ruby 1.9.3p429,rvm 1.21.1,而我的gemfile是v2.03。我已更新使用rvm update --system

當我鍵入rails server,我得到以下回溯:

/home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support  /dependencies.rb:251:in `require': cannot load such file -- java (LoadError) 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/pdf_ravager-0.1.0/lib/pdf_ravager/field_types/acro_form.rb:1:in `<top (required)>' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/pdf_ravager-0.1.0/lib/pdf_ravager/fields/text.rb:1:in `<top (required)>' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/pdf_ravager-0.1.0/lib/pdf_ravager/template.rb:1:in `<top (required)>' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/pdf_ravager-0.1.0/lib/pdf_ravager.rb:2:in `<top (required)>' 
from /home/user/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' 
from /home/user/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' 
from /home/user/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each' 
from /home/user/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require' 
from /home/user/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each' 
from /home/user/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require' 
from /home/user/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler.rb:132:in `require' 
from /home/user/Documents/cred/config/application.rb:15:in `<top (required)>' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in <top (required)>' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap' 
from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in `<main>' 

我已經試過卸載軌和刪除所有的寶石,但我得到一個類似的錯誤消息,當我使用sudo gem uninstall rails

我沒有在一個點按照這個腳本(這裏找到http://6brand.com/how-to-downgrade-rubygems.html)降級RubyGems的,因爲它似乎更新是造成問題:

rubygems=`ruby --disable-gems -S gem which rubygems` 
echo $rubygems 
rm $rubygems 
rm -rf `dirname $rubygems`/rubygems 

也許這造成的腐敗,但我後來重新安裝紅寶石和更新的RubyGems使用rvm。

任何幫助將不勝感激!

UPDATE:

謝謝回答!我確實刪除了pdf_ravager gem,因爲我沒有使用JRuby,然後進行了捆綁安裝。現在我發現了以下回溯...好像他精極度緊張的寶石,它必須是一個依賴,導致問題出現:

/home/saasbook/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:246:in `block in visit_Psych_Nodes_Alias': Unknown alias: test (Psych::BadAlias) 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:246:in `fetch' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:246:in `visit_Psych_Nodes_Alias' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:264:in `block in revive_hash' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:258:in `each' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:258:in `each_slice' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:258:in `revive_hash' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:273:in `block in revive_hash' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:258:in `each' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:258:in `each_slice' 
    from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:258:in `revive_hash' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:238:in `visit_Psych_Nodes_Document' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych/nodes/node.rb:35:in `to_ruby' 
from /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych.rb:128:in `load' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application/configuration.rb:115:in `database_configuration' 
from /home/user/.rvm/gems/[email protected]/gems/activerecord-3.2.13/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
from /home/user/.rvm/gems/[email protected]/gems/activerecord-3.2.13/lib/active_record/base.rb:720:in `<top (required)>' 
from /home/user/.rvm/gems/[email protected]/gems/devise-2.0.5/lib/devise/orm/active_record.rb:42:in `<top (required)>' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/Documents/cred/config/initializers/devise.rb:26:in `block in <top (required)>' 
from /home/user/.rvm/gems/[email protected]/gems/devise-2.0.5/lib/devise.rb:284:in `setup' 
from /home/user/Documents/cred/config/initializers/devise.rb:3:in `<top (required)>' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing' 
from /home/user/Documents/cred/config/environment.rb:5:in `<top (required)>' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /home/user/.rvm/gems/[email protected]/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 
from /home/user/Documents/cred/config.ru:3:in `block in <main>' 
from /home/user/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval' 
from /home/user/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize' 
from /home/user/Documents/cred/config.ru:in `new' 
from /home/user/Documents/cred/config.ru:in `<main>' 
from /home/user/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval' 
from /home/user/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file' 
from /home/user/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/server.rb:200:in `app' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app' 
from /home/user/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app' 
from /home/user/.rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/server.rb:254:in `start' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap' 
from /home/user/.rvm/gems/[email protected]/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in `<main>' 

這裏是applicaion.rb文件:

require File.expand_path('../boot', __FILE__) 

# Pick the frameworks you want: 
require "active_record/railtie" 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "active_resource/railtie" 
require "sprockets/railtie" 
require 'net/http' 

# require "rails/test_unit/railtie" 

if defined?(Bundler) 
# If you precompile assets before deploying to production, use this line 
Bundler.require *Rails.groups(:assets => %w(development test)) 
# If you want your assets lazily compiled in production, use this line 
# Bundler.require(:default, :assets, Rails.env) 
end 

module Cred 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 

    # Custom directories with classes and modules you want to be autoloadable. 
    # config.autoload_paths += %W(#{config.root}/extras) 

    # Only load the plugins named here, in the order given (default is alphabetical). 
    # :all can be used as a placeholder for all plugins not explicitly named. 
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 

    # Activate observers that should always be running. 
    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 
    config.time_zone = 'Pacific Time (US & Canada)' 

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 
    # config.i18n.default_locale = :de 

    # Configure the default encoding used in templates for Ruby 1.9. 
config.encoding = "utf-8" 

    # Configure sensitive parameters which will be filtered from the log file. 
    config.filter_parameters += [:password] 

    # Enable the asset pipeline 
    config.assets.enabled = true 

    # Version of your assets, change this if you want to expire all your assets 
    config.assets.version = '1.0' 

    # Ensures that mass assignment error message is rendered 
    config.active_record.whitelist_attributes = true 

    # Forcing app not to access DB or load models when precompiling assets for Heroku 
    config.assets.initialize_on_precompile = false 

    config.middleware.use "BraintreeInterceptor" if Rails.env.test? 
    end 
end 

這裏是的Gemfile:

source 'http://rubygems.org' 

gem 'rails', '3.2.13' 
gem 'bootstrap-sass' 
gem 'bcrypt-ruby' 
gem 'faker' 
gem 'will_paginate' 
gem 'bootstrap-will_paginate' 
gem 'wicked' 
gem 'devise','~>2.0.0' 
gem 'devise_invitable', '~> 1.0.0' 
gem 'date_validator' 
gem 'recaptcha', :require => 'recaptcha/rails' 
gem 'docusign_rest',:git => "git://github.com/torcido/docusign_rest" 
gem 'multipart-post' 
gem 'sinatra' 
gem 'shotgun' 
gem 'braintree' 
gem "json", "~> 1.8.0" 
gem 'pdf-forms' 
gem 'spreadsheet' 
# Bundle edge Rails instead: 
# gem 'rails',  :git => 'git://github.com/rails/rails.git' 


# use Haml for templates 
gem 'haml' 

group :development do 
    gem 'haml-rails' 
end 

# create Rails3 compatible generators for config file 
gem 'rails3-generators' 


group :production do 
    gem 'pg' 
end 

group :development do 
    gem 'hpricot' 
    gem 'ruby_parser' 
    gem 'slim' 
    gem 'haml2slim' 
end 

group :test, :development do 
    gem 'pickle' 
    gem 'launchy'   # a useful debugging aid for user stories 
    gem 'pg' 
    gem "rspec" 
    gem "rspec-rails" 
    gem 'guard-spork', '0.3.2' 
    gem 'guard-rspec', '1.2.1' 
    gem 'childprocess', '0.3.6' 
end 

group :test do 
    gem 'capybara' 
    gem 'cucumber-rails', require: false 
    gem 'cucumber-rails-training-wheels' # some pre-fabbed step definitions 
    gem "factory_girl" 
    gem "factory_girl_rails" 
    gem 'database_cleaner' # to clear Cucumber's test database between runs 
end 

# High Voltage gem from Thoughtbot. Rails engine for static pages: https://github.com/thoughtbot/high_voltage 
gem 'high_voltage' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '3.2.3' 
    gem 'coffee-rails', '3.2.2' 
    gem 'uglifier', '1.2.3' 
    gem 'therubyracer',:require=>'v8' 
end 

gem 'jquery-rails',"~> 2.1.2" 
+1

您似乎在嘗試在/home/user/Documents/cred/config/application.rb中需要名爲java的文件/ gem。你能告訴我們你的Gemfile和你的application.rb文件嗎? – ZedTuX

回答

0

除非你正在運行的JRuby,你必須(至少根據source code)從你的Gemfile去除PDF破壞者。 This是試圖要求java的文件。

0

好的,我找到了一個半解決方案:我手動刪除了心靈寶石。我不得不手動這樣做,因爲gem uninstall命令也失敗了。

所以,我執行以下命令:

rm /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/psych.rb 
rm /home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/i686-linux/psych.so 

現在rails servergem uninstallautotest都在工作。好極了!

我之所以說半的解決方案是,當我運行這些命令,我​​收到以下消息前面:

/home/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>': 
It seems your ruby installation is missing psych (for YAML output). 
To eliminate this warning, please install libyaml and reinstall your ruby. 

然而,跟隨方向和安裝libyaml並重新安裝紅寶石後...我回到舊的心理錯誤回溯!

所以我很高興回到編寫我的應用程序,但我擔心這個顯然重要的缺失寶石。任何關於獲得一個乾淨的心靈寶石安裝的想法?