尝试运行rails应用时,我收到以下错误
rails s -p 5000
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: already initialized constant Net::SMTPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: previous definition of SMTPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: already initialized constant Net::POP
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: previous definition of POP was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: already initialized constant Net::POPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: previous definition of POPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: already initialized constant Net::POP3Session
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: previous definition of POP3Session was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: already initialized constant Net::APOPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: previous definition of APOPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'activeadmin'. (Bundler::GemRequireError)
什么原因导致捆绑包中出现Gem Require错误?
答案 0 :(得分:0)
您似乎已安装/加载了多个版本的gem tlsmail
。这就是原因,你得到它已被初始化的警告。你可以做的是运行:
gem list --local | grep 'tlsmail'
将返回已安装的gem版本列表。然后你可以删除其中一个版本(根据项目的依赖关系),看看是否有效。
gem uninstall tlsmail -v <version>
您可能还想检查Gemfile
中是否有不同版本的宝石。
希望有所帮助!
答案 1 :(得分:0)
我希望它尝试加载activeadmin
可能是activeadmin中的问题
检查gemfile和安装
gem 'activeadmin'
使用此命令安装activeadmin:Active admin install with Rails 4
答案 2 :(得分:0)
您是否初始化了宝石集? (因为你正在使用RVM)
在运行服务器
之前,按如下方式初始化gemsetrvm use ruby-2.3.0@rails425
用您的ruby版本和gemset名称替换ruby的版本和gemset的名称。