Tommy Nicholas
Tommy Nicholas

Reputation: 1173

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

I'm getting this error:

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

But I'm not in a rails directory, I'm on the desktop. There's no .bundle files anywhere to be found. Any ideas?

Upvotes: 0

Views: 3550

Answers (4)

Anant Vikram Singh
Anant Vikram Singh

Reputation: 558

I was having the same problem this morning and that's because rails was already been there while i was creating my application.

To remove the error just go to bin folder of your application and remove the rails folder, and try to create new rails application in your planned folder using rails new app_name.

enter image description here

Upvotes: 0

ATS45
ATS45

Reputation: 91

  1. cd bin/
  2. rm -rf rails

This fixed my problem. I was also getting the same error message

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

Upvotes: 9

colin0117
colin0117

Reputation: 1542

I was struggling with this over the weekend, but after lots of prodding and poking got it to work.

The problem for me was that Aptana (I believe) created a second rails script in my local bin directory (~/bin) which was called instead of the system script. This local version was older than /usr/local/bin/rails. After moving aside ~/bin/rails, "rails new fred" worked as expected.

Upvotes: 1

cvibha
cvibha

Reputation: 713

Try creating a new folder or rails app in root folder, under ~/

Upvotes: 0

Related Questions