Ruby 错误:“没有这样的文件或目录——脚本/生成(加载错误)"; [英] Ruby Error: "No such file or directory -- script/generate (LoadError)"

查看:84
本文介绍了Ruby 错误:“没有这样的文件或目录——脚本/生成(加载错误)";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道网络上的其他地方已经讨论过这个错误,这似乎是一个愚蠢的问题,但我在这里遇到了一个非常奇怪的情况.

I know that this error has been discussed elsewhere on the web, and this may seem like a stupid question, but I've got a very strange situation on my hands here.

我在 Snow Leopard 上运行,使用完全更新的 Ruby 和 Rails gem.我使用 ruby new testing 创建了一个新的 Rails 项目,然后使用 cd ~/testing 导航到该文件夹​​,并尝试使用 ruby script/创建一个基本的脚手架生成脚手架 newtest name:string,我又得到了这个错误:

I'm running on Snow Leopard, with fully updated Ruby and Rails gems. I created a new Rails project using ruby new testing, then navigated into that folder using cd ~/testing, and tried to create a basic scaffolding using ruby script/generate scaffold newtest name:string, and I got this error back:

ruby: 没有那个文件或目录 -- 脚本/生成 (LoadError)

ruby: No such file or directory -- script/generate (LoadError)

我在 Google 上进行了彻底的搜索,并尝试实施我能实现的所有解决方案,但没有任何效果.我不明白为什么我会出现这个错误或如何解决它.

I have searched Google thoroughly and tried to implement every solution that I could, but nothing has been working. I don't understand why I have this error or how to fix it.

推荐答案

如果你在 rails 3 上,那么命令是:

If you are on rails 3 then the command is:

rails generate scaffold newtest name:string

或者稍微短一点:

rails g scaffold newtest name:string

注意rails而不是ruby.

这篇关于Ruby 错误:“没有这样的文件或目录——脚本/生成(加载错误)";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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