我刚刚为Silentale API完成了一个新的开源gem,我面临一个奇怪的问题。在终端我收到一个错误,说它无法加载gem,但是它继续启动服务器加载它没有任何问题。
no such file to load -- silentale-on-rails
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `each'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/Users/nick/Projects/dummy_project/config/environment.rb:9
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
no such file to load -- silentale-on-rails
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `each'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:169:in `process'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/Users/nick/Projects/dummy_project/config/environment.rb:9
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
=> Call with -d to detach
=> Ctrl-C to shutdown server
有谁能告诉我这里出了什么问题?如果您想查看代码并查看可能的内容,可以通过以下方式安装gem;
$ sudo gem install silentale-on-rails
非常感谢!
答案 0 :(得分:0)
gem的名称(带连字符)与库文件的名称(lib / silentale_on_rails)不匹配。
你仍然可以加载它:
gem 'silentale-on-rails' # adds your gems' lib into the load path...
require 'silentale_on_rails' # ...so this now works.
最佳解决方案当然是具有一致的名称