0

When running rake db:migrate on my Arch machine, a huge stack-trace is printed and then rake gets aborted. It doesn't seem as if there is a real problem. All rows concern warnings about doubly defined constants.

[gilnaa@gilad-pc Hephaestus]$ rake db:migrate --trace | grep "error"
Unsupported rails environment for compass
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:2: warning: already initialized constant Rake::VERSION
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:2: warning: previous definition of VERSION was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::MAJOR
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: previous definition of MAJOR was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::MINOR
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: previous definition of MINOR was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::BUILD
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: previous definition of BUILD was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: already initialized constant Rake::Version::OTHER
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:5: warning: previous definition of OTHER was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:7: warning: already initialized constant Rake::Version::NUMBERS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:7: warning: previous definition of NUMBERS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake.rb:27: warning: already initialized constant RAKEVERSION
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake.rb:27: warning: previous definition of RAKEVERSION was here
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/early_time.rb:17: warning: already initialized constant Rake::EARLY
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/early_time.rb:17: warning: previous definition of EARLY was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/alt_system.rb:32: warning: already initialized constant Rake::AltSystem::WINDOWS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/alt_system.rb:32: warning: previous definition of WINDOWS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/linked_list.rb:100: warning: already initialized constant Rake::LinkedList::EMPTY
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/linked_list.rb:100: warning: previous definition of EMPTY was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/scope.rb:40: warning: already initialized constant Rake::Scope::EMPTY
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/scope.rb:40: warning: previous definition of EMPTY was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_utils.rb:9: warning: already initialized constant FileUtils::RUBY
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_utils.rb:9: warning: previous definition of RUBY was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_utils.rb:88: warning: already initialized constant FileUtils::LN_SUPPORTED
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_utils.rb:88: warning: previous definition of LN_SUPPORTED was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:16: warning: already initialized constant Rake::FileUtilsExt::DEFAULT
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:16: warning: previous definition of DEFAULT was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:44: warning: already initialized constant Rake::FileList::ARRAY_METHODS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:44: warning: previous definition of ARRAY_METHODS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:48: warning: already initialized constant Rake::FileList::MUST_DEFINE
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:48: warning: previous definition of MUST_DEFINE was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:52: warning: already initialized constant Rake::FileList::MUST_NOT_DEFINE
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:52: warning: previous definition of MUST_NOT_DEFINE was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:56: warning: already initialized constant Rake::FileList::SPECIAL_RETURN
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:56: warning: previous definition of SPECIAL_RETURN was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:62: warning: already initialized constant Rake::FileList::DELEGATING_METHODS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:62: warning: previous definition of DELEGATING_METHODS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:370: warning: already initialized constant Rake::FileList::DEFAULT_IGNORE_PATTERNS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:370: warning: previous definition of DEFAULT_IGNORE_PATTERNS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:376: warning: already initialized constant Rake::FileList::DEFAULT_IGNORE_PROCS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/file_list.rb:376: warning: previous definition of DEFAULT_IGNORE_PROCS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/promise.rb:11: warning: already initialized constant Rake::Promise::NOT_SET
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/promise.rb:11: warning: previous definition of NOT_SET was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:13: warning: already initialized constant Rake::CommandLineOptionError
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:13: warning: previous definition of CommandLineOptionError was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:38: warning: already initialized constant Rake::Application::DEFAULT_RAKEFILES
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:38: warning: previous definition of DEFAULT_RAKEFILES was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:725: warning: already initialized constant Rake::Application::FIXNUM_MAX
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:725: warning: previous definition of FIXNUM_MAX was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task_arguments.rb:88: warning: already initialized constant Rake::EMPTY_TASK_ARGS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task_arguments.rb:88: warning: previous definition of EMPTY_TASK_ARGS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/invocation_chain.rb:55: warning: already initialized constant Rake::InvocationChain::EMPTY
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/invocation_chain.rb:55: warning: previous definition of EMPTY was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:3: warning: already initialized constant Rake::Backtrace::SYS_KEYS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:3: warning: previous definition of SYS_KEYS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:4: warning: already initialized constant Rake::Backtrace::SYS_PATHS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:4: warning: previous definition of SYS_PATHS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:7: warning: already initialized constant Rake::Backtrace::SUPPRESSED_PATHS
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:7: warning: previous definition of SUPPRESSED_PATHS was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:11: warning: already initialized constant Rake::Backtrace::SUPPRESSED_PATHS_RE
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:11: warning: previous definition of SUPPRESSED_PATHS_RE was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:12: warning: already initialized constant Rake::Backtrace::SUPPRESS_PATTERN
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/backtrace.rb:12: warning: previous definition of SUPPRESS_PATTERN was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake.rb:72: warning: already initialized constant FileList
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake.rb:72: warning: previous definition of FileList was here
/usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake.rb:73: warning: already initialized constant RakeFileUtils
/home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake.rb:73: warning: previous definition of RakeFileUtils was here
rake aborted!
stack level too deep
/usr/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:217

Rails version is 4.0.0 How can I fix this?

3
  • Which rails version are you working with?
    – ssantos
    Nov 3, 2013 at 17:01
  • Sorry for forgetting this. Rails 4.0 Nov 3, 2013 at 17:03
  • Have a look at the url I posted, it looks promising...
    – ssantos
    Nov 3, 2013 at 17:15

3 Answers 3

0

Just in case you didn't reach it, this may help.-

http://samuelanthony12.wordpress.com/2013/08/04/unsupported-rails-environment-for-compass-compass-rails/

1
  • I looked at it, updated the Compass version in the Gemfile and tried migrating. Same again, except the compass line at the start doesn't appear. Nov 3, 2013 at 17:19
0

Solved the problem by removing and reinstalling rake.

0

Actually, let's take a good look at the first two warning messages (lines folded for readability): /usr/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:2: warning: already initialized constant Rake::VERSION /home/gilnaa/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/version.rb:2: warning: previous definition of VERSION was here

As you can see, rake is installed in both /usr/lib/ruby/gems and /home/gilnaa/.gem/ruby/2.0.0/gems. One of these is clearly too much. As you discovered, removing either one will work around the issue. You could also try setting an explicit GEM_PATH to select the proper set of gems.

However, the best solution is to use bundler, and start rake with bundle exec rake db:migrate. Bundler goes out of its way to make your application as independent of its environment as possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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