在`gem_original_require'中:没有要加载的文件-haml(MissingSourceFile)
但是这个宝石已经装好了
我也有此路径的插件:-/ home / techvant / rails_app / techease / vendor / plugins / haml / init.rb
此初始化文件具有以下代码:-
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:在
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:inrequire' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in
从/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb的require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in
new_constants_in'中:156:inrequire' from /home/techvant/rails_app/techease/vendor/plugins/haml/init.rb:4:in
'来自/usr/lib/ruby/gems/1.8/gems/rails-2.3.2 /lib/rails/plugin.rb:146evaluate_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:invaluate_init_rbevaluate_init_rb' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin.rb:48:in
载入中 来自/home/techvant/rails_app/techease/config/../vendor/plugins/siteninja/engines/lib/engines/plugin.rb:77:in load'fromload' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:38:in
来自/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb的load_plugins中:37: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:348load_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:113load_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-send' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in
运行中/home/techvant/rails_app/techease/config/environment.rb:9从/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 31:在gem_original_require' from /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
:31:在require'从/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support /dependencies.rb:156:inrequire' 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:inrequire' 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中的rbrequire' 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
要求/来自脚本/服务器:3
由于haml是一颗宝石,我将其放在environment.rb中:
config.gem 'haml'
然后,解压缩并将其添加到仓库中:
rake gems:install
rake gems:unpack
最后,删除已有的haml插件引用。
尝试:
宝石更新轨道
...在服务器上,而不是您的开发机器上
您可以尝试解开gems的包装,使它们位于rails应用程序目录中,这将使您的rails应用程序不再依赖于系统中的本地gems。 干杯!
我在这个问题上也有很多麻烦。 这是我最终采取的解决步骤。
首先,安装gem。
放
config.gem 'haml'
在您的environment.rb文件中。 实际上,我不得不将其放在我的环境/development.rb和环境/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服务器。