【问题标题】:rails server just prints command usage [duplicate]rails服务器只打印命令用法[重复]
【发布时间】:2013-10-19 14:42:28
【问题描述】:
$ rails server

用法: rails new APP_PATH [选项]

Options:
  -r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                                 # Default: /home/bikram/.rvm/rubies/ruby-1.9.3-p448/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
  -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) # 默认:sqlite3 -j, [--javascript=JAVASCRIPT] # 预配置选定的 JavaScript 库 # 默认:jquery -J, [--skip-javascript] # 跳过 JavaScript 文件 [--dev] # 设置应用程序,让 Gemfile 指向你的 Rails checkout [--edge] # 使用指向 Rails 存储库的 Gemfile 设置应用程序 -T, [--skip-test-unit] # 跳过测试::单元文件 [--old-style-hash] # 在 Ruby >= 1.9 上强制使用旧式哈希 (:foo => 'bar')

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.

它是这样生成的,但不是 rails 本地服务器。其他版本是:

  • Rails 3.2.14
  • ruby 1.9.3p448(2013-06-27 修订版 41675)[i686-linux]
  • 宝石 2.1.9
  • rvm 1.23.9(稳定)

我的 gem 文件是:

source 'https://rubygems.org'

gem 'rails', '3.2.14'

group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
  gem 'capybara', '1.1.2'
end

group :production do
  gem 'pg', '0.12.2'
end

【问题讨论】:

    标签: ruby-on-rails rvm


    【解决方案1】:

    这是当您尝试在没有 Rails 应用程序的文件夹中启动 Rails 服务器时生成的默认消息。

    您需要运行rails new <appname>,其中appname 是您在启动服务器之前所在的文件夹。

    如果它是 Rails 应用程序,那么您可能会丢失一些关键文件,服务器命令使用这些文件来确定它是否是 Rails 应用程序。

    【讨论】:

    • 我已经完美地完成了所有步骤...仍然无法使用该命令正在使用我之前创建的另一个应用程序...
    【解决方案2】:

    我猜你正在运行命令 rails server 而不是在 Rails 应用程序的(根目录)中。

    进入您的 Rails 项目目录,然后重试。

    【讨论】:

    • 我正好在根目录下
    • 甚至“rails generate rspec:install”这个命令也给了我同样的结果
    猜你喜欢
    • 1970-01-01
    • 2016-10-01
    • 1970-01-01
    • 2012-12-18
    • 1970-01-01
    • 2014-12-31
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多