简体   繁体   中英

Rails app accidentally installed in root folder

I accidentally created a Rails app in my root directory. 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.

How do I remove this app from my root directory?

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

rm -rf test_app

Hoping you're on *nix based system.

  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:

     rm -fr rails_project_in_root_dir 

    where rails_project_in_root_dir is the Rails application directory in your root directory.

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

That ended up resolving the issue. Thanks for the help guys.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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