Ruby on Rails,未找到 Rakefile 错误 [英] Ruby on Rails , No Rakefile found error

查看:81
本文介绍了Ruby on Rails,未找到 Rakefile 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 rails、postgres 上安装了 ruby​​.我安装了所有必需的 gem 文件,我创建了一个项目 http://guides.rubyonrails.org/getting_started.html 想要>

我在 config/routes.rb 中添加了以下代码

Blog::Application.routes.draw 做资源:帖子根到:欢迎#index"结尾

我正在尝试运行 rake routes 命令.

但是我明白了

rake 中止!未找到 Rakefile(查找:rakefile、Rakefile、rakefile.rb、Rakefile.rb)

我检查了互联网.每个人都说我需要在确切的项目文件夹下运行它".但我需要说的是,我在 Windows 7 上尝试了近 20 个不同的文件夹.(我快疯了)

我不完全知道您的专家需要什么,但是:

我使用:

Windows 7 Ultimate(64 位)Ruby200-x64rake-10.1.0

提前致谢..

解决方案

听起来您的 Rakefile 可能丢失了,或者您可能不在应用的根目录"中.

cd 到你的博客目录,你应该看到,

$ ls应用程序/仓/配置/D b/...

如果它不存在,则创建一个名为 Rakefile 的新文件并将此文本放入其中.

#!/usr/bin/env rake# 在 lib/tasks 中以 .rake 结尾的文件中添加您自己的任务,# 例如 lib/tasks/capistrano.rake,它们将自动对 Rake 可用.需要 File.expand_path('../config/application', __FILE__)博客::Application.load_tasks

I installed ruby on rails, postgres. I installed all required gem files, I created a project as http://guides.rubyonrails.org/getting_started.html wants

I added below code in config/routes.rb

Blog::Application.routes.draw do
  resources :posts
  root to: "welcome#index"
end

I am trying to run rake routes command.

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)

I don't exactly know what is necessary for you experts, but :

I use :

Windows 7 Ultimate (64bit) Ruby200-x64 rake-10.1.0

Thanks in advance..

解决方案

Sounds like your Rakefile might be missing, or you might not be in the app's "root directory".

cd to your blog directory, and you should see,

$ ls
  app/
  bin/
  config/
  db/
  ...

If it doesn't exist already, create a new file named Rakefile and put this text in there.

#!/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

这篇关于Ruby on Rails,未找到 Rakefile 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆