Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

RubyOnRails - Server Problem

I can't seem to setup the rails server correctly. When I attempt to connect to http://0.0.0.0:3000 it cannot display the page. Here is my CMD output:

C:\Sites>rvm use 1.9.3 'rvm' is not recognized as an internal or external command, operable program or batch file.

C:\Sites>rails new treebook create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/images/rails.png create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/mailers create app/models create app/views/layouts/application.html.erb create app/mailers/.gitkeep create app/models/.gitkeep create config create config/routes.rb create config/application.rb create config/environment.rb create config/environments create config/environments/development.rb create config/environments/production.rb create config/environments/test.rb create config/initializers create config/initializers/backtrace_silencers.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/secret_token.rb create config/initializers/session_store.rb create config/initializers/wrap_parameters.rb create config/locales create config/locales/en.yml create config/boot.rb create config/database.yml create db create db/seeds.rb create doc create doc/README_FOR_APP create lib create lib/tasks create lib/tasks/.gitkeep create lib/assets create lib/assets/.gitkeep create log create log/.gitkeep create public create public/404.html create public/422.html create public/500.html create public/favicon.ico create public/index.html create public/robots.txt create script create script/rails create test/fixtures create test/fixtures/.gitkeep create test/functional create test/functional/.gitkeep create test/integration create test/integration/.gitkeep create test/unit create test/unit/.gitkeep create test/performance/browsing_test.rb create test/test_helper.rb create tmp/cache create tmp/cache/assets create vendor/assets/javascripts create vendor/assets/javascripts/.gitkeep create vendor/assets/stylesheets create vendor/assets/stylesheets/.gitkeep create vendor/plugins create vendor/plugins/.gitkeep run bundle install Fetching source index for https://rubygems.org/ Using rake (10.0.3) Using i18n (0.6.1) Using multi_json (1.6.1) Using activesupport (3.2.1) Using builder (3.0.4) Using activemodel (3.2.1) Using erubis (2.7.0) Using journey (1.0.4) Using rack (1.4.5) Using rack-cache (1.2) Using rack-test (0.6.2) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.1.3) Using actionpack (3.2.1) Using mime-types (1.21) Using polyglot (0.3.3) Using treetop (1.4.12) Using mail (2.4.4) Using actionmailer (3.2.1) Using arel (3.0.2) Using tzinfo (0.3.35) Using activerecord (3.2.1) Using activeresource (3.2.1) Using bundler (1.0.22) Using coffee-script-source (1.4.0) Using execjs (1.4.0) Using coffee-script (2.2.0) Using rack-ssl (1.3.3) Using json (1.7.7) Using rdoc (3.12.1) Using thor (0.14.6) Using railties (3.2.1) Using coffee-rails (3.2.2) Using jquery-rails (2.2.1) Using rails (3.2.1) Using sass (3.2.6) Using sass-rails (3.2.6) Using sqlite3 (1.3.7) Using uglifier (1.3.0) Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed.

C:\Sites>cd treebook

C:\Sites\treebook>rails server => Booting WEBrick => Rails 3.2.1 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server SECURITY WARNING: No secret option provided to Rack::Session::Cookie. This poses a security threat. It is strongly recommended that you provide a secret to prevent exploits that may be possible from crafted cookies. This will not be supported in future versions of Rack, and future versions will even invalidate your existing user cookies.

    Called from: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/action

pack-3.2.1/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initi alize'.

[2013-02-23 03:35:25] INFO WEBrick 1.3.1 [2013-02-23 03:35:25] INFO ruby 1.9.3 (2012-02-16) [i386-mingw32] [2013-02-23 03:35:25] INFO WEBrick::HTTPServer#start: pid=7688 port=3000

As you can see RVM isn't recognized. I am running Windows 7 32bit.

3 Answers

James Barnett
James Barnett
39,199 Points

@Kirk -

On windows the way to start rails is to type rails s webbrick will then tell you the address it's starting on. By default you can access the rails web server webbrick on 127.0.0.1:3000.

Both the rvm and 0.0.0.0 only apply if you are working on a OS X.

You can kill the process or use CTRL-Break to stop the webbrick server.

@James,

Thank you for your support. I wasn't aware of this while watching the video but I just notice the teacher notes.

Thanks.

James Barnett
James Barnett
39,199 Points

@Kirk - You're quite welcome