更新
事实证明问题与我腐败的confg / boot.rb有关。细节在下面的答案中。
所以基本上rake停止了工作。我试图添加一个新模型,如果我再运行
rake db:migrate
我明白了:
Error: Command 'db:migrate' not recognized
我非常确定rake已正确安装并获得了源代码。如果我跑:
rake
我得到了正常的男人'以
开头的页面 Usage: rails COMMAND [ARGS]...The most common rails commands are...
有趣的是,它也在底部吐出了这个:
.../db/schema.rb doesn't exist yet. Run 'rake db:migrate' to create it, then try again. If you do not intend to use a database, you should instead alter .../config/application.rb to limit the frameworks that will be loaded.
我打算使用数据库,所以我喜欢耙子工作......
我错过了一些明显的东西吗?
提前致谢!
答案 0 :(得分:0)
你是否通过捆绑尝试了?
bundle exec rake db:migrate
答案 1 :(得分:0)
事实证明问题是由于我错误地按照SO post关于更改rails server
绑定到的端口的说明。
基本上我错误地修改了config / boot.rb,它以某种方式破坏了rake
的行为。
具体来说,我完全误读并将前两个答案混为一谈,将以下代码附加到config / boot.rb而不是将其放在独立脚本中。
# THIS IS NEW:
require "rails/commands/server"
module Rails
class Server
def default_options
super.merge({
:Port => 10524,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru")
})
end
end
end
# END OF CHANGE
require 'rails/commands'
对不起伙计们。谢谢你的帮助!