Rails服务器已启动但localhost:3000显示错误

时间:2013-07-22 11:07:50

标签: ruby-on-rails

我刚刚安装了http://rubyinstaller.org/中的Ruby on Rails包(这是我第一次尝试在我的xp sp3系统中在rails工作站上设置ruby)。安装过程完美无误。我使用它的控制台启动了服务器。服务器已启动但 http:// localhost:3000 显示错误页面(未找到页面)。 我在控制台中显示以下内容。我什么都错了?

#Rails Environment Configuration.

---
git:
  user.name:  XYZ
  user.email: xyzuser
  version:    git version 1.8.1.msysgit.1

ruby:
  bin:        C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
  version:    ruby 1.9.3p392 (2013-02-22) [i386-mingw32]

rails:
  bin:        C:/RailsInstaller/Ruby1.9.3/bin/rails.bat
  version:    Rails 3.2.13

ssh:
  public_key_location: C:\Documents and Settings\xyz/.ssh/id_rsa.pub
  public_key_contents: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArYKMRvMHxKJ2R//5viqQp
D4IQhVcKZhhbfvZGzDOXF1M//pewAQDK2x9y8T8irvatgmDMCYB5L2uZiyXwG3gPm6Bfw44mCHhNP8xN
bT2OSDnvIoZcFVfmQExZmwWcSNqm0NionObUV+IFKvfjg9bOPl4GBUqSXSTlUmAn/wQq0c/m+GoJwDlI
dV/h69dq4tHYwpCMFUZ9k4LqR4VICktV5Fi1VQA14u4Y9kOWAAyAfzeXnOzcpkbYxgjbCvAf20gM6lSL
9NvNsLuzI5yLxhI5wAmZbK+11zgNmx019tbv1uHvZRV2Z53aWpErtuvipAieQ977U4kYQPMyFf8g8BKd
Q== XYZ<xyzuser>




C:\Sites>

服务器启动时的控制台输出是:

C:\Sites>rails s
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                                 # Default: C:/RailsInstaller/Ruby1.9.3/bin/ruby
.exe
  -b, [--builder=BUILDER]        # Path to a application builder (can be a files
ystem path or URL)
  -m, [--template=TEMPLATE]      # Path to an application template (can be a fil
esystem 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
  -S, [--skip-sprockets]         # Skip Sprockets files
  -d, [--database=DATABASE]      # Preconfigure for selected database (options:
mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3
/jdbcpostgresql/jdbc)
                                 # Default: sqlite3
  -j, [--javascript=JAVASCRIPT]  # Preconfigure for selected JavaScript library
                                 # Default: jquery
  -J, [--skip-javascript]        # Skip JavaScript files
      [--dev]                    # Setup the application with Gemfile pointing t
o your Rails checkout
      [--edge]                   # Setup the application with Gemfile pointing t
o Rails repository
  -T, [--skip-test-unit]         # Skip Test::Unit files
      [--old-style-hash]         # Force using old style hash (:foo => 'bar') on
 Ruby >= 1.9

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Suppress status output
  -s, [--skip]     # Skip files that already exist

Rails options:
  -h, [--help]     # Show this help message and quit
  -v, [--version]  # Show Rails version number and quit

Description:
    The 'rails new' command creates a new Rails application with a default
    directory structure and configuration at the path you specify.

    You can specify extra command-line arguments to be used every time
    'rails new' runs in the .railsrc configuration file in your home directory.

    Note that the arguments specified in the .railsrc file don't affect the
    defaults values shown above in this help message.

Example:
    rails new ~/Code/Ruby/weblog

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
    See the README in the newly created application to get going.

C:\Sites>

4 个答案:

答案 0 :(得分:1)

谢谢大家。最后,我得到了它的工作。问题是 test_app 文件夹中的 Gemfile 。我评论了宝石'uglifier','&gt; = 1.0.3'这一行,我得到了它的帮助。希望它能够进一步发挥作用,让我继续前进。

答案 1 :(得分:0)

您必须在创建的rails项目的目录中cd,然后rails s才能正常工作。

这也意味着服务器尚未启动。请仔细阅读控制台命令的输出,大多数时候他们会告诉您他们做了什么,或者他们为什么不按预期工作。

答案 2 :(得分:0)

服务器未启动。您需要导航到rails app文件夹,安装所需的gem并启动服务器:

cd <your app folder>
bundle install
rails s

答案 3 :(得分:0)

首先,您必须创建一个新的rails项目。我认为C:/ Sites不是你的rails项目目录。

rails new test_app

它将在您的目录中创建一个rails项目。而不是去CD test_app。并尝试启动您的服务器。 希望它能奏效。