Ruby on Rails,未找到 Rakefile 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18452701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ruby on Rails , No Rakefile found error
提问by Tim Tuckle
I installed ruby on rails, postgres. I installed all required gem files, I created a project as http://guides.rubyonrails.org/getting_started.htmlwants
我在 rails、postgres 上安装了 ruby。我安装了所有必需的 gem 文件,我创建了一个项目,如http://guides.rubyonrails.org/getting_started.html想要的
I added below code in config/routes.rb
我在 config/routes.rb 中添加了以下代码
Blog::Application.routes.draw do
resources :posts
root to: "welcome#index"
end
I am trying to run rake routescommand.
我正在尝试运行rake routes命令。
But i get
但我明白了
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
I checked internet.. Everybody says "i need to run it under exact project folder". But i need to say, I tried almost 20 different folders on my Windows 7. (I am getting crazy)
我检查了互联网.. 每个人都说“我需要在确切的项目文件夹下运行它”。但我需要说的是,我在 Windows 7 上尝试了近 20 个不同的文件夹。(我快疯了)
I don't exactly know what is necessary for you experts, but :
我不完全知道您的专家需要什么,但是:
I use :
我用 :
Windows 7 Ultimate (64bit) Ruby200-x64 rake-10.1.0
Windows 7 Ultimate(64 位)Ruby200-x64 rake-10.1.0
Thanks in advance..
提前致谢..
回答by tonyedwardspz
I was having the same problem, and spent ages trying different commands, replacing rakefiles etc.
我遇到了同样的问题,花了很长时间尝试不同的命令,替换 rakefiles 等。
Turned out I was not in the app's root directory within the Command Prompt. :(
结果我不在命令提示符中的应用程序根目录中。:(
回答by ddavison
Sounds like your Rakefilemight be missing, or you might not be in the app's "root directory".
听起来您Rakefile可能丢失了,或者您可能不在应用程序的“根目录”中。
cdto your blog directory, and you should see,
cd到你的博客目录,你应该看到,
$ ls
app/
bin/
config/
db/
...
If it doesn't exist already, create a new file named Rakefileand put this text in there.
如果它不存在,请创建一个名为的新文件Rakefile并将此文本放入其中。
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Blog::Application.load_tasks
回答by daniel_fahy
I don't know why but this worked for me. worth a try
我不知道为什么,但这对我有用。值得一试
heroku rake db:migrate
Found it on this discussion
在这个讨论中找到它

