简体   繁体   English

Rails应用程序意外安装在根文件夹中

[英]Rails app accidentally installed in root folder

I accidentally created a Rails app in my root directory. 我不小心在根目录中创建了一个Rails应用程序。 I ran the following command and got an error: 我运行了以下命令,但出现错误:

rails new test_app
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.

So I tried running 所以我尝试跑步

bundle exec rails server

and it looks like the server is listening on port 3000. 看起来服务器正在侦听端口3000。

How do I remove this app from my root directory? 如何从根目录中删除此应用程序?

只需删除文件夹,或者您可以执行此命令

rm -rf test_app

Hoping you're on *nix based system. 希望您使用基于* nix的系统。

  1. Stop the running server using: 使用以下命令停止正在运行的服务器:

     kill -9 $(lsof -t -i :3000) 
  2. Change working directory to root using: 使用以下命令将工作目录更改为根目录:

     cd / 

    or wherever you're defining your root as. 或将根定义为的位置。

  3. Remove the accidentally created Rails application directory using: 使用以下命令删除意外创建的Rails应用程序目录:

     rm -fr rails_project_in_root_dir 

    where rails_project_in_root_dir is the Rails application directory in your root directory. 其中rails_project_in_root_dir是您的根目录中的Rails应用程序目录。

Okay, I'm not sure how it got installed in the root directory, but I ended up just manually deleting all the folders and files that get created when you run 好的,我不确定它是如何安装在根目录中的,但是我最终只是手动删除了在运行时创建的所有文件夹和文件

rails new app

Here's where I found the list of files: 在这里找到文件列表:

http://guides.rubyonrails.org/getting_started.html http://guides.rubyonrails.org/getting_started.html

That ended up resolving the issue. 最终解决了这个问题。 Thanks for the help guys. 感谢您的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM