我正在努力让我的 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/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /home/user/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /home/user/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /home/user/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p429@global/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>'
我已经尝试卸载 rails 并删除所有 gem,但是当我使用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
也许这会导致损坏,但我随后重新安装了 ruby 并使用 rvm 更新了 rubygems。
任何帮助将非常感激!
更新:
感谢回复!我确实删除了 pdf_ravager gem,因为我没有使用 JRuby,然后进行了捆绑安装。现在我得到以下回溯......似乎他的 Psych gem,它必须是一个依赖项,正在引起问题:
/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/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/application/configuration.rb:115:in `database_configuration'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activerecord-3.2.13/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activerecord-3.2.13/lib/active_record/base.rb:720:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/devise-2.0.5/lib/devise/orm/active_record.rb:42:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/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@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/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/ruby-1.9.3-p429@anewhope/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/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/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/ruby-1.9.3-p429@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/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@anewhope/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/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/ruby-1.9.3-p429@anewhope/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/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/ruby-1.9.3-p429@anewhope/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /home/user/.rvm/gems/ruby-1.9.3-p429@anewhope/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"