错误:尝试执行[ruby script / generate]时没有这样的文件或目录?

时间:2023-01-20 01:13:21

I am writing a small blog application using Rails. I am using Aptana Studio.

我正在使用Rails编写一个小型博客应用程序。我正在使用Aptana Studio。

When I try to execute:

当我尝试执行时:

ruby script/generate scaffold post title:string body:text

from either Aptana Studio or going to the project folder and executing it from the shell, I get this error:

从Aptana Studio或转到项目文件夹并从shell执行它,我收到此错误:

c:\Ruby200\bin\ruby.exe: No such file or directory -- script/generate (LoadError
)

1 个解决方案

#1


3  

I think you are meaning to do rails generate?

我认为你的意思是做轨道生成?

First create a new Rails app:

首先创建一个新的Rails应用程序:

rails new random_app
cd random_app
rails generate scaffold post title:string body:text

When you "ruby" something, it looks for a file to execute.

当你“ruby”某事时,它会查找要执行的文件。

Rails is the framework for abstraction and scaffolding.

Rails是抽象和脚手架的框架。

See "Why does Ruby "script/generate" return "No such file or directory"?".

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

Rails 3 is the problem. Since Rails 3, all of the "script/whatever" commands have been replaced with "rails whatever".

Rails 3就是问题所在。从Rails 3开始,所有的“script / whatever”命令都被“rails whatever”所取代。

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

所以现在你想要rails generate ...或者rails服务器。

#1


3  

I think you are meaning to do rails generate?

我认为你的意思是做轨道生成?

First create a new Rails app:

首先创建一个新的Rails应用程序:

rails new random_app
cd random_app
rails generate scaffold post title:string body:text

When you "ruby" something, it looks for a file to execute.

当你“ruby”某事时,它会查找要执行的文件。

Rails is the framework for abstraction and scaffolding.

Rails是抽象和脚手架的框架。

See "Why does Ruby "script/generate" return "No such file or directory"?".

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

Rails 3 is the problem. Since Rails 3, all of the "script/whatever" commands have been replaced with "rails whatever".

Rails 3就是问题所在。从Rails 3开始,所有的“script / whatever”命令都被“rails whatever”所取代。

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

所以现在你想要rails generate ...或者rails服务器。