Ruby on Rails,未找到 Rakefile 错误

编程入门 行业动态 更新时间:2024-10-28 15:33:29
本文介绍了Ruby on Rails,未找到 Rakefile 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在 rails、postgres 上安装了 ruby​​.我安装了所有必需的 gem 文件,我创建了一个项目 guides.rubyonrails/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 guides.rubyonrails/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 错误

本文发布于:2023-10-27 06:41:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532612.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:未找到   错误   Ruby   Rails   Rakefile

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!