当我在生产中部署我的ror应用程序时,我收到了以下错误

时间:2010-02-01 15:30:27

标签: ruby-on-rails ruby rubygems ruby-on-rails-plugins

:没有要加载的文件 - haml(MissingSourceFile)

但是这个宝石已经出现了。

我也有这个路径的插件: - / home / techvant / rails_app / techease / vendor / plugins / haml / init.rb

此init文件包含以下代码: -

begin
     require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
   rescue LoadError
     require 'haml' # From gem
end

我需要解决此错误,请帮忙。

以下是错误跟踪。

  

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- haml (MissingSourceFile) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require'           来自/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in new_constants_in'           来自/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /home/techvant/rails_app/techease/vendor/plugins/haml/init.rb:4:in evaluate_init_rb'           来自/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin.rb:146:in evaluate_init_rb' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings'           来自/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin.rb:142:in evaluate_init_rb' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin.rb:48:in load'           来自/home/techvant/rails_app/techease/config/../vendor/plugins/siteninja/engines/lib/engines/plugin.rb:77:in load' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:38:in load_plugins'           来自/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in each' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in load_plugins'           来自/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:348:in load_plugins' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:163:in进程'           来自/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in send' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in run'           来自/home/techvant/rails_app/techease/config/environment.rb:9           来自/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require'           来自/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in new_constants_in'           来自/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require'           来自/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in`requiren'           来自脚本/服务器:3

4 个答案:

答案 0 :(得分:1)

由于haml是一个宝石,我将它放在environment.rb:

config.gem 'haml'

然后,解压缩并将其添加到repo:

rake gems:install
rake gems:unpack

最后,删除你已经获得的haml插件引用。

答案 1 :(得分:0)

尝试:

  

gem update rails

...在服务器上,而不是您的开发机器

答案 2 :(得分:0)

您可以尝试解压缩宝石,使它们位于您的rails应用目录中,这将取消您的rails应用程序取决于您系统中的本地宝石。干杯!

答案 3 :(得分:0)

我也遇到了很多问题。以下是我最终解决它的步骤。

首先,安装gem。

config.gem 'haml' 

在environment.rb文件中。我实际上不得不把它放在我的环境/ development.rb和environments / production.rb(等)中,因为它抱怨不知道rails_env。哪个不是最优的,但它有效。 然后运行

rake gems:install

然后

mkdir -p /vendor/plugins/haml
cp vendor/gems/haml-2.2.0/init.rb /vendor/plugins/haml/init.rb

然后重新启动rails服务器。