heroku rake db:migrate fails

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 09:59:31

问题


I get the following error:

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

rake aborted!

undefined method `root' for Heroku::Rails:Module /app/Rakefile: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

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/5660169/heroku-rake-dbmigrate-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!