Daniel Kehoe
Daniel Kehoe

Reputation: 10952

Ruby 2.5.0 warnings with Rake and RVM

After installing Ruby 2.5 using RVM, and building an application using Rails5.2.0.rc1, I get warnings whenever I run rake:

/Users/danielkehoe/.rvm/gems/ruby-2.5.0@global/gems/rake-12.3.0/lib/rake/file_utils.rb:10: 
        warning: already initialized constant FileUtils::RUBY
/Users/danielkehoe/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/file_utils.rb:10: 
    warning: previous definition of RUBY was here
/Users/danielkehoe/.rvm/gems/ruby-2.5.0@global/gems/rake-12.3.0/lib/rake/file_utils.rb:109: 
        warning: already initialized constant FileUtils::LN_SUPPORTED

Upvotes: 2

Views: 1157

Answers (3)

Mark Weston
Mark Weston

Reputation: 1163

Unfortunately none of tm.'s methods worked for me.

When I looked at my global gemset, I had a version 1.1.0 of fileutils installed as well as the default 1.0.2

gem uninstall fileutils removed the 1.1.0 version and this downgrade to 1.0.2 solved the problem.

Upvotes: 5

tm.
tm.

Reputation: 314

It is related to RVM. Specifically, it's because the rake gem is symlinked from the installed copy of ruby into the @global gemset, but bin/rake is not symlinked. As a result, rake tries to load copies of certain library files twice--once from the standard ruby gem tree and one from the @global gemset tree.

I've found several workarounds:

  • Use bundle exec rake
  • For Rails, use bin/rails
  • For Rails 5+, use rails <cmd> (or bin/rails)
  • Forcibly install a duplicate copy of the rake gem into your current gemset. This will preempt the standard + @global gemset copy of rake, thus avoiding the issue.

Upvotes: 3

Mohsen Alizadeh
Mohsen Alizadeh

Reputation: 1603

It seems the issue is related torvm.

check the issue created for rake project

Upvotes: 0

Related Questions