rails server fails to start – bin/rails:6: warning: previous definition of APP_PATH was here

If rails server fails to start for you due to APP_PATH issue below:

Navid:someapp navid$ rails s
=> Booting WEBrick
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
bin/rails:6: warning: already initialized constant APP_PATH
/Users/navid/Documents/navid/someapp/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

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")
 plugin new   Generates skeleton for developing a Rails 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.

I was able to fix the above issue in two ways:

You can either comment out the spring gem or do the following instead, which I recommend:

From within your project directory, do the following:

Do the following at your own risk!!! Keep a backup of your project directory before you start doing this.

Copy off your rails and rake scripts just in case or back up your entire project directory

cp bin/rails /tmp/rails (or some other directory)
cp bin/rake /tmp/rake (or some other directory)
rake rails:update:bin
spring binstub --all

‘rails server’ command should work for you now.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
rails server fails to start - bin/rails:6: warning: previous definition of APP_PATH was here, 5.0 out of 5 based on 1 rating
Facebook Twitter Email

Leave a Reply