开发者

heroku rake db:migrate fails

开发者 https://www.devze.com 2023-02-25 16:29 出处:网络
I get the following error: [app (master)]$ heroku rake db:migrate rake aborted! undefined method `root\' for Heroku::Rails:Module /app/Rake开发者_C百科file:7

I get the following error:

[app (master)]$ heroku rake db:migrate

rake aborted!

undefined method `root' for Heroku::Rails:Module /app/Rake开发者_C百科file:7

(See full trace by running task with --trace) (in /app)

I can't figure out how to run trace as suggested by the error (heroku rake db:migrate --trace gives "Invalid Option --trace"), and I don't believe this is related to the well-known "heroku doesn't use sqlite3" issue.

My Rakefile is as follows:

require File.expand_path('../config/application', __FILE__)
require 'rake'

SampleApp::Application.load_tasks


SELF-SOLVED

Ultimately, the solution to this problem was found in 2 stages:

1) I discovered that my rvm gemset list was blank. Not sure when or how this happened, because it was set before. It may be related to me messing around with RubyMine settings, which allow you to tweak the Ruby SDK and Gems manually. I did an rvm gemset to set the correct set, and then rvm gemset install and rvm gemset update to get all the proper gems loaded into the environment. I'll be honest, I don't fully understand what's going on here and how it inter-relates with the manual gem install commands, so it's very possible I mucked the whole thing up through my meager understanding of RVM.

At this point, heroku rake db:migrate still failed with the same error, however:

2) My Heroku credentials had somehow become disconnected. I'm guessing Git & Rake were failing due to that. Again, I don't fully understand the ramifications here, but ultimately, the solution was right in front of my face on the Heroku Setup page. Once I retyped heroku create, my existing credentials were set properly again, and rake stopped failing.

SUMMARY

I was half tempted to just delete or forget about this post (since I self-fixed), but I'm guessing I'm not the only Rails noob that will be frustrated by errors like these. I'm guessing they (the errors) were caused by me fumbling around the system (especially RubyMine) trying to figure out how everything was interconnected. Since the answers to problems such as these are probably not self evident to new Ruby/Rails programmers, I'll leave this up.


Did you try heroku logs to have a look at the log files?

0

精彩评论

暂无评论...
验证码 换一张
取 消