Rails server not starting and giving error messages

My current ruby version is ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0] and rails version is 4.0.0

Every time I run any rails command I get following message first:

/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler- 1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /usr/local in PATH, mode 040777

I was able to create new rails app, but when I start the server using

rails server or rails s

I get following message —

/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /usr/local in PATH, mode 040777
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007f9019eec2c0 @paths=["/Users/aniruddhabarapatre1/RubyRails/profile/config/routes.rb"], @route_sets=[#<ActionDispatch::Routing::RouteSet:0x007f9019d795c8>]> (RuntimeError)
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/aniruddhabarapatre1/RubyRails/profile/config/environment.rb:5:in `<top (required)>'
from /Users/aniruddhabarapatre1/RubyRails/profile/config.ru:3:in `require'
from /Users/aniruddhabarapatre1/RubyRails/profile/config.ru:3:in `block in <main>'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/aniruddhabarapatre1/RubyRails/profile/config.ru:in `new'
from /Users/aniruddhabarapatre1/RubyRails/profile/config.ru:in `<main>'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

I’m stuck on this since last 2 days and would greatly appreciate any help. Just want to start with Rails and create some apps. But this initial setup is frustrating.

you can change the port of the server to listen.

rails server -p 3001 or open the terminal and type lsof -i tcp:portnumber. kill the process and restart again…

If the error persist than delete the .pid file inside the project directory and restart again.

I hope i will work fine.

Fahad,

Thanks for the response. I tried changing port but getting same error.

As for .pid file, I’m not sure what it its. I tried searching in the project folder but couldn’t find it.

My current ruby version is ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0] and rails version is 4.0.0

Every time I run any rails command I get following message first:

/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler- 1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /usr/local in PATH, mode 040777

I don't use a Mac but that appears to be warning you that the folder mentioned can be written to by any user. Whether that is normal for a Mac I don't know. As far as rails is concerned it is just a warning.

I was able to create new rails app, but when I start the server using

    rails server or rails s

I get following message ---

/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /usr/local in PATH, mode 040777 => Booting WEBrick => Rails 4.0.0 application starting in development on http://0.0.0.0:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server Exiting /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007f9019eec2c0 @paths=["/Users/aniruddhabarapatre1/RubyRails/profile/config/routes.rb"], @route_sets=[#<ActionDispatch::Routing::RouteSet:0x007f9019d795c8>]> (RuntimeError) from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated' from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'

......

from /Users/aniruddhabarapatre1/RubyRails/profile/config/environment.rb:5:in `<top (required)>'

Did you get any errors when you ran bundle install?

Do you get the above error with the application as generated by 'rails new' or have you made some changes?

Post the first few lines of environment.rb, making sure it is clear which is line 5, where the error is occurring.

Colin

Colin,

Created another new project with no errors. Although if I do —

bundle show rails

or any gem file, it couldn’t locate gemfile.

This is what I have in my environment.rb

Load the Rails application.

require File.expand_path(‘…/application’, FILE)

Initialize the Rails application.

Profile::Application.initialize!

Please don't top post, it makes it difficult to follow the thread. Thanks.

Colin,

Created another new project with no errors.

Good

Although if I do ---

   bundle show rails

or any gem file, it couldn't locate gemfile.

Are you running that from within the rails application folder (the same folder from which you run bundle install and rails s)?

This is what I have in my environment.rb

It is pointless showing us that as you no longer have the crash there.

Colin

I tried running bundle show rails from my project, parent and home folder. Everytime I got same message.

I tried running bundle show rails from my project, parent and home folder.

I asked that you not top post.

Everytime I got same message.

Go to the top level of your rails application (the folder where you have successfully run bundle install and rails s). Run bundle install from there. Then run bundle show rails. Copy the complete sequence of commands and results here.

Colin

Not sure what you really mean by top post. I’m not doing this on purpose. I’d avoid this if I know what exactly it is.

I could run bundle install successfully but not rails server even once and get those above message.

Not sure what you really mean by top post. I'm not doing this on purpose. I'd avoid this if I know what exactly it is.

http://lmgtfy.com/?q=top+post

Not sure what you really mean by top post. I’m not doing this on purpose.

I’d avoid this if I know what exactly it is.

http://lmgtfy.com/?q=top+post

Got it. Thanks.

Could you please help me resolve issue now.

> Not sure what you really mean by top post. I'm not doing this on > purpose. > I'd avoid this if I know what exactly it is.

http://lmgtfy.com/?q=top+post

Got it. Thanks.

Could you please help me resolve issue now.

Difficult, because you do not provide the information I ask for. I asked you to -

>> Go to the top level of your rails application (the folder where you >> have successfully run bundle install and rails s). >> Run bundle install from there. Then run bundle show rails. Copy the >> complete sequence of commands and results here.

Though now you say that you have not managed to run the server, though earlier you said you had no errors with the new project. Anyhow I assume that bundle install does work, since you have not said otherwise, so run the commands above and post the results here please.

Colin

Colin

Not sure what you really mean by top post. I’m not doing this on

purpose.

I’d avoid this if I know what exactly it is.

http://lmgtfy.com/?q=top+post

Got it. Thanks.

Could you please help me resolve issue now.

Difficult, because you do not provide the information I ask for. I

asked you to -

Go to the top level of your rails application (the folder where you

have successfully run bundle install and rails s).

Run bundle install from there. Then run bundle show rails. Copy the

complete sequence of commands and results here.

Though now you say that you have not managed to run the server, though

earlier you said you had no errors with the new project. Anyhow I

assume that bundle install does work, since you have not said

otherwise, so run the commands above and post the results here please.

I think we’ve some miscommunication over here.

I created a new rails app – rails new dummy

then went inside that folder and ran command – bundle install

Using rake (10.1.1) Using i18n (0.6.9) Using minitest (4.7.5) Using multi_json (1.8.2) Using atomic (1.1.14) Using thread_safe (0.1.3) Using tzinfo (0.3.38) Using activesupport (4.0.2) Using builder (3.1.4) Using erubis (2.7.0) Using rack (1.5.2) Using rack-test (0.6.2) Using actionpack (4.0.2) Using mime-types (1.25.1) Using polyglot (0.3.3) Using treetop (1.4.15) Using mail (2.5.4) Using actionmailer (4.0.2) Using activemodel (4.0.2) Using activerecord-deprecated_finders (1.0.3) Using arel (4.0.1) Using activerecord (4.0.2) Using coffee-script-source (1.6.3) Using execjs (2.0.2) Using coffee-script (2.2.0) Using thor (0.18.1) Using railties (4.0.2) Using coffee-rails (4.0.1) Using hike (1.2.3) Using jbuilder (1.5.3) Using jquery-rails (3.0.4) Using json (1.8.1) Using bundler (1.3.5) Using tilt (1.4.1) Using sprockets (2.10.1) Using sprockets-rails (2.0.1) Using rails (4.0.2) Using rdoc (3.12.2) Using sass (3.2.13) Using sass-rails (4.0.1) Using sdoc (0.3.20) Using sqlite3 (1.3.8) Using turbolinks (2.1.0) Using uglifier (2.4.0) Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

This is my output for bundle install.

bundle show rails – /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/rails-4.0.2

If I give cmd – rails server, it runs successfully.

Although if I go back to my earlier app Profile, I am still unable to start server.

... I think we've some miscommunication over here.

Yes you are correct.

I created a new rails app -- rails new dummy ... If I give cmd -- rails server, it runs successfully.

Although if I go back to my earlier app Profile, I am still unable to start server.

OK, now I understand. So the problem is something to do with your other app. Does it use Devise? I ask because googling for rescue in execute_if_updated shows a number of people having that problem with Devise. See

for example.

Googling for error messages can often be useful.

Colin

I think we’ve some miscommunication over here.

Yes you are correct.

I created a new rails app – rails new dummy

If I give cmd – rails server, it runs successfully.

Although if I go back to my earlier app Profile, I am still unable to start

server.

OK, now I understand. So the problem is something to do with your

other app. Does it use Devise? I ask because googling for

rescue in execute_if_updated

shows a number of people having that problem with Devise. See

http://stackoverflow.com/questions/16653431/devise-not-working-with-rails-4-0rc1

for example.

Googling for error messages can often be useful.

Thanks Colin. It helped a lot. It seems I had issues in my config/route file.

I had created a new home page and had defined ‘home’ method.

This code was causing further issues –

route to: “profile#home”