16

Currently I am facing a weird warning messages on deploy:assets:precompile at production deploy through capistrano.

When I ran cap production deploy for first time deployment of my demo Rails project, getting following warning messages and deploy failed with cap aborted!

#<Thread:0x0000558ae4eef218@/home/.rvm/gems/ruby-2.5.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /home/.rvm/gems/ruby-2.5.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/.rvm/gems/ruby-2.5.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing on host IP: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: /home/ubuntu/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/protocol.rb:66: warning: already initialized constant Net::ProtocRetryError
/home/ubuntu/apps/demo-test/shared/bundle/ruby/2.5.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:66: warning: previous definition of ProtocRetryError was here
/home/ubuntu/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/protocol.rb:172: warning: already initialized constant Net::BufferedIO::BUFSIZE
/home/ubuntu/apps/demo-test/shared/bundle/ruby/2.5.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:206: warning: previous definition of BUFSIZE was here
/home/ubuntu/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/protocol.rb:439: warning: already initialized constant Net::NetPrivate::Socket
/home/ubuntu/apps/demo-test/shared/bundle/ruby/2.5.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:503: warning: previous definition of Socket was here
rake stderr: Nothing written
(Backtrace restricted to imported tasks)
cap aborted!

Thanks in advance.

3 Answers 3

30

same here, it seems like a wird issue with gem dependencies https://github.com/ruby/net-imap/issues/16

If you add gem "net-http" in your gem file the issue should go This gem should anyway be already present in your gemfile.lock as a dependency

edit

Once you upgraded successfully, you can remove the gem from your file This is a update dependency bug. Once updated, you are good

3
  • 1
    Adding gem "net-http" also worked for me. Just an extra note, according to this comment on the issue you link to, it says the problem should go away soon if/when a dependency is altered. So we could possibly remove the net-http gem at some point in the future.
    – stevec
    Jan 24, 2022 at 11:31
  • Turns out bundler had a dependency load issue. So the solution above is but one of many results. The new bundler has fixed this. I will answer the question, as I've been monitoring its behaviour.
    – Rich_F
    Jan 26, 2022 at 19:15
  • works like a charm - thanks. I was using ruby 2.7.2 and oauth2 1.4.7, that caused the warning to occur. Adding gem "net-http" to my gemfile did the trick. Jan 30, 2022 at 20:12
2

the updated answer from the thread linked above that worked for me was adding these to the gemfile.

gem "net-http"
gem "net-smtp"
gem "net-imap"
gem "uri", "0.10.0"
0

Bunder was the culprit, with some dependency issues. Update with:

bundle update --bundler
4
  • 2
    This alone didn't work for me. Should we still add gem "net-http" first?
    – stevec
    Feb 13, 2022 at 15:17
  • Re-read what Nathan said above. Check your Gemfile.lock file to see if it's called already, then use Bundle.require.
    – Rich_F
    Feb 13, 2022 at 15:19
  • For me, it wasn't in Gemfile.lock. I only got the warnings when running this zeitwerk check. I'm not sure how important it was to fix, but for me adding gem "net-http" to Gemfile was sufficient.
    – stevec
    Feb 13, 2022 at 15:25
  • net-http is not in the core, so it needs to be in your Gemfile. rubygems.org/gems/net-http
    – Rich_F
    Feb 13, 2022 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.