lllllll
lllllll

Reputation: 4835

"rails server" on existing working application not starting

I'm happily configuring my new laptop to work on my already existing projects. I copied the folder of an application and all its subfolders, and now have it in the new laptop. It seems I cannot start the server by typing rails server command at the root of the project. I tried to create a new project and start it and it works just fine, so I really have no idea of what to do. Rails versions are the same and identical Gemfile. This is the result of the rails server command:

Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                             # Default: /home/toni/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
  -b, [--builder=BUILDER]        # Path to a application builder (can be a filesystem   path or URL)
  -m, [--template=TEMPLATE]      # Path to an application template (can be a filesystem path or URL)
  [--skip-gemfile]           # Don't create a Gemfile
  [--skip-bundle]            # Don't run bundle install
  -G, [--skip-git]               # Skip Git ignores and keeps
  -O, [--skip-active-record]     # Skip Active Record files
ETC...

thanks!

Upvotes: 1

Views: 3607

Answers (2)

kstevens715
kstevens715

Reputation: 760

In Rails 3.x, this will occur when script/rails is missing. The file could accidentally have been deleted or it may have never been committed to source control if you've just cloned the project to another machine. You'll need to find or regenerate it.

Rails determines if it's actually "in" a Rails project by checking if script/rails exists. If it doesn't find that file, it assumes it's not a Rails project: https://github.com/rails/rails/blob/v3.2.21/railties/lib/rails/script_rails_loader.rb#L21-L23

There is an option you can pass 'rails new' to ignore files that already exist:

rails new APPNAME -s

You could try running that over your existing project to replace any missing files.

See also: http://guides.rubyonrails.org/v3.2.13/initialization.html

Upvotes: 6

mbuechmann
mbuechmann

Reputation: 5740

Judging from the output of the rails command it seems that you do not execute the command 'rails server' in the root directory of a rails project.

You should check if you are in the correct directory and if all files have been copied.

Upvotes: 1

Related Questions