为什么 Ruby 会“脚本/生成”?返回“没有这样的文件或目录”?

发布于 2024-10-05 12:06:11 字数 678 浏览 0 评论 0原文

我在使用 script/generate 时遇到问题。我正在遵循 基于树的导航 教程,该教程表示使用 script /plugin install git://github.com/rails/acts_as_tree.gitscript/generate nifty_layout

我不断得到:

没有这样的文件或目录——脚本/插件

我尝试过这些变体:

script/generate nifty_layout
rails generate nifty_layout
ruby script/generate nifty_layout
ruby generate nifty_layout

它们都告诉我:

-bash:脚本/生成:没有这样的文件或目录

我错过了什么吗?这里完全是红宝石努比,我似乎找不到答案。

编辑:Mac OS X 10.6 上的 Rails 3

I am having trouble using script/generate. I am following the tree based navigation tutorial, which says to use script/plugin install git://github.com/rails/acts_as_tree.git or script/generate nifty_layout.

I keep getting:

No such file or directory -- script/plugin

I've tried these variations:

script/generate nifty_layout
rails generate nifty_layout
ruby script/generate nifty_layout
ruby generate nifty_layout

and they all tell me:

-bash: script/generate: No such file or directory

Am I missing something? Total ruby nuby here and I just can't seem to find an answer.

edit: rails 3 on Mac OS X 10.6

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

盗心人 2024-10-12 12:06:11

Rails 3 是你的问题(或者更确切地说是问题的原因)。自 Rails 3 起,所有“script/whatever”命令都已替换为“railswhatever”。

所以现在你想要“rails generated ...”或“rails server”。

查看教程时请务必查看版本号或发布日期:)
连锁:
Rails 3 中缺少 script/generate

Rails 3 is your problem (or rather the cause of). Since rails 3 all of the "script/whatever" commands have been replaced with "rails whatever".

So now you want "rails generate ..." or "rails server" instead.

Be sure to watch version numbers or post dates when looking at tutorials :)
linkage:
Missing script/generate in Rails 3

一身软味 2024-10-12 12:06:11

由于 Rails 发展迅速且非常流行,现在互联网上有很多过时的信息。我使用 Ruby on Rails 指南 作为我获取信息的第一站,因为这些页面似乎是最新的。

railsgenerate 信息似乎是最新的。

There is a LOT of out-of-date information on the interwebs for Rails now as a result of it evolving quickly and being so popular. I use the Ruby on Rails Guides as my first stop for information as those pages seem to be the most current.

The rails generate info seems current.

鹿! 2024-10-12 12:06:11

你可以尝试一些事情,首先,确保因为你使用的是 Rails 3,所以你已经运行了“bundle install”。根据您安装 Rails 的方式以及您使用的捆绑程序版本,它可能找不到您的 Rails 二进制文件来执行 railsgenerate ..,因此您可以尝试在它前面加上 bundle execrails 前缀g 但这已被弃用,如果您调用它,您应该收到警告。另外,请确保您遵循 ryan 在他的库上针对 Rails 3 的说明(并在添加到 gemfile 后运行捆绑安装): https://github.com/ryanb/nifty-generators

you may try a couple things, first, make sure since you are using rails 3 that you have run 'bundle install'. depending on how you installed rails and which version of bundler you are using, it may not be finding your rails binary to execute the rails generate .. so you may try prefixing it with bundle exec rails g but that is deprecated and you should get a warning if you call it. Also, make sure you are following ryan's instructions for rails 3 (and run bundle install once you add to the gemfile) on his library: https://github.com/ryanb/nifty-generators

掀纱窥君容 2024-10-12 12:06:11

作为 Rails 服务器的快捷方式,您可以使用“rails s”。对于控制台,“rails c”也是如此。

As a shortcut to rails server, you can use 'rails s'. Similarly for the console, 'rails c'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文