約束の地

キャロ組

rails c した際に fileutils の警告が大量に出た場合

結論

以下の手順を踏みます。

$ gem uninstall fileutils
$ gem update fileutils --default

以下のように返ってくれば OK です。

$ gem list | grep fileutils
fileutils (default: 1.1.0, default: 1.0.2)

これで rails c の際に冗長な警告が出なくなるでしょう。

$ rails c
Running via Spring preloader in process 27191
Loading development environment (Rails 5.2.1)
irb(main):001:0> exit

参考

バージョン

  • Rails version: 5.2.1
  • Ruby version: 2.5.3
  • rbenv 1.1.1-39-g59785f6

警告が出た際の生ログ

$ rails c
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:90: warning: already initialized constant FileUtils::VERSION
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:92: warning: previous definition of VERSION was here
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1188: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1267: warning: previous definition of S_IF_DOOR was here
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1446: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1541: warning: previous definition of DIRECTORY_TERM was here
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1448: warning: already initialized constant FileUtils::Entry_::SYSCASE
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1543: warning: previous definition of SYSCASE was here
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1501: warning: already initialized constant FileUtils::OPT_TABLE
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1596: warning: previous definition of OPT_TABLE was here
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1555: warning: already initialized constant FileUtils::LOW_METHODS
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1650: warning: previous definition of LOW_METHODS was here
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1562: warning: already initialized constant FileUtils::METHODS
/Users/FOOBAR/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1657: warning: previous definition of METHODS was here
Running via Spring preloader in process 26433
Loading development environment (Rails 5.2.1)
irb(main):001:0>

警告を出なくするまでの一連の生ログ

$ gem list | grep fileutils
fileutils (1.1.0, default: 1.0.2)
$ gem uninstall fileutils
Successfully uninstalled fileutils-1.1.0
$ gem update fileutils --default
Updating installed gems
Updating fileutils
Fetching: fileutils-1.1.0.gem (100%)
Successfully installed fileutils-1.1.0
Done installing documentation for fileutils after 0 seconds
Done installing documentation for fileutils after 0 seconds
Gems updated: fileutils
$ gem list | grep fileutils
fileutils (default: 1.1.0, default: 1.0.2)
$ bundle exec rails c
Running via Spring preloader in process 27191
Loading development environment (Rails 5.2.1)
irb(main):001:0>
Powered by はてなブログ