没有要加载的文件 - sendgrid-ruby(LoadError)

时间:2016-06-06 07:39:30

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-3.2 sendgrid

我的rails应用程序正在生产环境中工作,但是当我尝试在开发环境中运行它时会出错:

  

没有要加载的文件 - sendgrid-ruby(LoadError)

/Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- sendgrid-ruby (LoadError)  
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:312:in `depend_on'  
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:225:in `require_dependency'  
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/engine.rb:444:in `block (2 levels) in eager_load!'  
    from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/engine.rb:443:in `each'  
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/engine.rb:443:in `block in eager_load!'  
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/engine.rb:441:in `each'  
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/engine.rb:441:in `eager_load!'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/initializable.rb:30:in `run'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/initializable.rb:54:in `each'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/application.rb:136:in `initialize!'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/adityashukla/Downloads/sprint4/config/environment.rb:5:in `<top (required)>'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
from /Users/adityashukla/Downloads/sprint4/config.ru:3:in `block in <main>'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
from /Users/adityashukla/Downloads/sprint4/config.ru:in `new'
from /Users/adityashukla/Downloads/sprint4/config.ru:in `<main>'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/commands/server.rb:46:in `app'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/commands/server.rb:70:in `start'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
from /Users/adityashukla/.rvm/gems/ruby-1.9.3-p551-install/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'  
    from script/rails:6:in `require'
from script/rails:6:in `<main>'  

我的Gemfile:

source 'http://rubygems.org'    
gem 'rails', '3.2.16'
gem 'mysql2', '~> 0.3.17' 
group :assets do  
gem 'sass-rails',   '~> 3.2.3'  
gem 'coffee-rails', '~> 3.2.1'  
gem 'uglifier', '>= 1.0.3'  
gem 'compass-rails'  
gem 'therubyracer', :require => 'v8'  
end  
gem 'sendgrid_ruby', '~> 0.0.6'  
gem 'mailgun', '~> 0.8', require: 'mailgun'  
gem 'net-ssh', '~> 2.9', '>= 2.9.2'  
gem 'jquery-rails'

这是我的应用程序controller.rb文件

  

class ApplicationController&lt;的ActionController ::基

require 'mailgun'  
require 'sendgrid-ruby'  

请提前帮助,谢谢。

1 个答案:

答案 0 :(得分:1)

您的Gemfile指定了gem sendgrid_ruby,但根据https://github.com/sendgrid/sendgrid-ruby/blob/master/sendgrid-ruby.gemspec的gem名称是sendgrid-ruby(即使用连字符,而不是下划线)。

这可能是问题吗?也许尝试将Gemfile的条目更改为sendgrid-ruby

我刚试过安装两者的宝石 - 他们都安装不同的宝石。

我不知道为什么它在生产环境中有效。它是不同的机器还是Ruby版本?