4
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rake コマンドで already initialized constant FileUtils::RUBY

Last updated at Posted at 2018-01-29

rake コマンドで下記エラー

👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇

/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_utils.rb:10: warning: already initialized constant FileUtils::RUBY
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_utils.rb:10: warning: previous definition of RUBY was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_utils.rb:109: warning: already initialized constant FileUtils::LN_SUPPORTED
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_utils.rb:109: warning: previous definition of LN_SUPPORTED was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_utils_ext.rb:17: warning: already initialized constant Rake::FileUtilsExt::DEFAULT
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_utils_ext.rb:17: warning: previous definition of DEFAULT was here
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:44: warning: already initialized constant Rake::FileList::ARRAY_METHODS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:44: warning: previous definition of ARRAY_METHODS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:47: warning: already initialized constant Rake::FileList::MUST_DEFINE
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:47: warning: previous definition of MUST_DEFINE was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:51: warning: already initialized constant Rake::FileList::MUST_NOT_DEFINE
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:51: warning: previous definition of MUST_NOT_DEFINE was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:55: warning: already initialized constant Rake::FileList::SPECIAL_RETURN
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:55: warning: previous definition of SPECIAL_RETURN was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:61: warning: already initialized constant Rake::FileList::DELEGATING_METHODS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:61: warning: previous definition of DELEGATING_METHODS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:86: warning: already initialized constant Rake::FileList::GLOB_PATTERN
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:86: warning: previous definition of GLOB_PATTERN was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:381: warning: already initialized constant Rake::FileList::DEFAULT_IGNORE_PATTERNS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:381: warning: previous definition of DEFAULT_IGNORE_PATTERNS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:387: warning: already initialized constant Rake::FileList::DEFAULT_IGNORE_PROCS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/file_list.rb:387: warning: previous definition of DEFAULT_IGNORE_PROCS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:3: warning: already initialized constant Rake::VERSION
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:3: warning: previous definition of VERSION was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: already initialized constant Rake::Version::MAJOR
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: previous definition of MAJOR was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: already initialized constant Rake::Version::MINOR
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: previous definition of MINOR was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: already initialized constant Rake::Version::BUILD
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: previous definition of BUILD was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: already initialized constant Rake::Version::OTHER
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:6: warning: previous definition of OTHER was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:8: warning: already initialized constant Rake::Version::NUMBERS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/version.rb:8: warning: previous definition of NUMBERS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/linked_list.rb:110: warning: already initialized constant Rake::LinkedList::EMPTY
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/linked_list.rb:110: warning: previous definition of EMPTY was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/scope.rb:41: warning: already initialized constant Rake::Scope::EMPTY
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/scope.rb:41: warning: previous definition of EMPTY was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/promise.rb:12: warning: already initialized constant Rake::Promise::NOT_SET
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/promise.rb:12: warning: previous definition of NOT_SET was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/application.rb:13: warning: already initialized constant Rake::CommandLineOptionError
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/application.rb:13: warning: previous definition of CommandLineOptionError was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/application.rb:41: warning: already initialized constant Rake::Application::DEFAULT_RAKEFILES
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/application.rb:41: warning: previous definition of DEFAULT_RAKEFILES was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/task_arguments.rb:108: warning: already initialized constant Rake::EMPTY_TASK_ARGS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/task_arguments.rb:108: warning: previous definition of EMPTY_TASK_ARGS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/invocation_chain.rb:55: warning: already initialized constant Rake::InvocationChain::EMPTY
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/invocation_chain.rb:55: warning: previous definition of EMPTY was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/early_time.rb:21: warning: already initialized constant Rake::EARLY
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/early_time.rb:21: warning: previous definition of EARLY was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/late_time.rb:17: warning: already initialized constant Rake::LATE
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/late_time.rb:17: warning: previous definition of LATE was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:4: warning: already initialized constant Rake::Backtrace::SYS_KEYS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:4: warning: previous definition of SYS_KEYS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:5: warning: already initialized constant Rake::Backtrace::SYS_PATHS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:5: warning: previous definition of SYS_PATHS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:8: warning: already initialized constant Rake::Backtrace::SUPPRESSED_PATHS
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:8: warning: previous definition of SUPPRESSED_PATHS was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:12: warning: already initialized constant Rake::Backtrace::SUPPRESSED_PATHS_RE
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:12: warning: previous definition of SUPPRESSED_PATHS_RE was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:16: warning: already initialized constant Rake::Backtrace::SUPPRESS_PATTERN
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake/backtrace.rb:16: warning: previous definition of SUPPRESS_PATTERN was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake.rb:70: warning: already initialized constant FileList
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake.rb:70: warning: previous definition of FileList was here
/usr/share/nginx/html/vendor/bundle/ruby/2.2.0/gems/rake-12.3.0/lib/rake.rb:71: warning: already initialized constant RakeFileUtils
/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-12.3.0/lib/rake.rb:71: warning: previous definition of RakeFileUtils was here

原因

rbenvを使ってrubyをインストールしましたが、

下記を実行したため

bundle install --path ./vendor/bundle/

このため、vendor/bundleのgem、rbenvでインストールした、rubyの中のgemが一緒に走りこんな長いエラー、
既に動いてるぜ的な感じ、
なので、

rails project の ./vendor/bundleを削除し、./bundle/configの参照先パスをコメントアウトし、rbenv内のgem達のみを、みに行くようにします。

手順

cd /rails/project_root/
rm -rf vendor/bundle
bundle install
vi .bundle/config

BUNDLE_PATH: "./vendor/bundle/" <!-- こうなっているものを下記のようにします。-->
<!-- BUNDLE_PATH: "./vendor/bundle/" --> 

上記で完了

確認

rake -T
rake about                              # List versions of all Rails frameworks and the environment
rake app:template                       # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake app:update                         # Update configs and some other initially generated files (or use just update:configs or update:bin)
rake assets:clean[keep]                 # Remove old compiled assets
rake assets:clobber                     # Remove compiled assets
rake assets:environment                 # Load asset compile environment
rake assets:precompile                  # Compile all the assets named in config.assets.precompile
rake cache_digests:dependencies         # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake cache_digests:nested_dependencies  # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake db:create                          # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all ...
rake db:drop                            # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to d...
rake db:environment:set                 # Set the environment value for the database
rake db:fixtures:load                   # Loads fixtures into the current environment's database
rake db:migrate                         # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:status                  # Display status of migrations
rake db:rollback                        # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear              # Clears a db/schema_cache.dump file
rake db:schema:cache:dump               # Creates a db/schema_cache.dump file
rake db:schema:dump                     # Creates a db/schema.rb file that is portable against any DB supported by Active Record
rake db:schema:load                     # Loads a schema.rb file into the database
rake db:seed                            # Loads the seed data from db/seeds.rb
rake db:setup                           # Creates the database, loads the schema, and initializes with the seed data (use db:reset to also drop the d...
rake db:structure:dump                  # Dumps the database structure to db/structure.sql
rake db:structure:load                  # Recreates the databases from the structure.sql file
rake db:version                         # Retrieves the current schema version number
rake dev:cache                          # Toggle development mode caching on/off
rake initializers                       # Print out all defined initializers in the order they are invoked by Rails
rake log:clear                          # Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
rake middleware                         # Prints out your Rack middleware stack
rake notes                              # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom                       # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake restart                            # Restart app by touching tmp/restart.txt
rake routes                             # Print out all defined routes in match order, with names
rake secret                             # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sess...
rake stats                              # Report code statistics (KLOCs, etc) from the application or engine
rake test                               # Runs all tests in test folder
rake test:db                            # Run tests quickly, but also reset db
rake time:zones[country_or_offset]      # List all time zones, list by two-letter country code (`rails time:zones[US]`), or list by UTC offset (`rail...
rake tmp:clear                          # Clear cache and socket files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear)
rake tmp:create                         # Creates tmp directories for cache, sockets, and pids

完了です。

4
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?