Ruby on Rails 错误:无法在另一个目录中初始化新的 Rails 应用程序,请先切换到非 Rails 目录

wag*_*325 3 ruby ruby-on-rails

我在Desktop/rails_projects. 根据另一篇文章,我必须清空受影响的目录,这会阻止我创建新项目。帖子说.bundle folder如果我用ls -a.

但是,我的问题是我在创建新的 Rails 应用程序之前创建了 rails_projects,这意味着那里什么都没有。另外,我试过在下面创建另一个文件夹Desktop/aNewFolder,同样的事情发生了。也许桌面本身有问题?我不知道。我做ls -a了Desktop但我找不到.bundle folder.另外,我不能只是擦除桌面上的所有内容。那太荒谬了。

这就是我尝试在$rails new first_app里面做的事情Desktop/rails_projects:

Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.
Run Code Online (Sandbox Code Playgroud)

当我输入 rails 时收到了这个:

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 benchmarker  See how fast a piece of code runs
 profiler     Get profile information from a piece of code
 plugin       Install a plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.
Run Code Online (Sandbox Code Playgroud)

非常感谢你的帮助!!!

小智 5

就我而言,我意识到项目结构中的所有文件都是在 user 下创建的C:\Users\Sergio。应用程序文件夹、bin、config、db、lib、log、public、test、tmp 和 vendor。这种情况下的解决方案是删除文件,aptana 开始正常运行。