错误 // 用法:rails new APP_PATH [options] // 当运行 'rails server' 时

问题描述 投票:0回答:6

背景信息:

我正在使用 GIT 获取包含 Ruby 文件的项目存储库。该项目位于我的 Mac 主目录下的 SITES 文件夹中。

我有红宝石:1.8.7

我刚刚将 Rails 升级到:3.0.3

我想要完成的就是能够在我已经下载的 GIT 项目的浏览器中呈现 localhost.com:3000,以便我可以在本地处理它。

我运行命令“rails server”并返回以下消息::

Usage:
  rails new APP_PATH [options]

Options:
      [--skip-gemfile]        # Don't create a Gemfile
  -m, [--template=TEMPLATE]   # Path to an application template (can be a filesystem path or URL)
  -d, [--database=DATABASE]   # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
                              # Default: sqlite3
  -O, [--skip-active-record]  # Skip Active Record files
  -J, [--skip-prototype]      # Skip Prototype files
  -T, [--skip-test-unit]      # Skip Test::Unit files
      [--dev]                 # Setup the application with Gemfile pointing to your Rails checkout
  -r, [--ruby=PATH]           # Path to the Ruby binary of your choice
                              # Default: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  -G, [--skip-git]            # Skip Git ignores and keeps
  -b, [--builder=BUILDER]     # Path to an application builder (can be a filesystem path or URL)
      [--edge]                # Setup the application with Gemfile pointing to Rails repository

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

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.

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.
ruby-on-rails upgrade
6个回答
18
投票

您从错误的目录运行

rails server
。进入包含您的应用程序的目录并从那里运行命令。例如,如果您运行了
rails new thingy
,那么当您使用
thingy
时,您必须位于
rails server
目录中。


9
投票

我在从 Rails 2 升级到 Rails 3 时也遇到了这个问题。然后我运行

rails new .
来替换所有必要的文件,之后就成功了。


3
投票

其他问题可能是:

您必须从根目录删除bin文件夹或其中的一些文件。请恢复它,一切都会正常工作。


0
投票

你的文件夹目录应该在 Gemfile 中,


0
投票

通常,如果您克隆存储库或使用 Docker,像

.gitignore
.dockerignore
这样的文件具有不包含 bin 文件夹的说明,请签入这两个文件并只需删除其中的行即可。

您可以在另一个目录中执行

rails new
并将生成的bin文件夹复制到您的项目中,然后推送到您的存储库。


0
投票

确保您的项目中有一个

bin/
目录,否则运行
bundle exec rake rails:update:bin
(在您的项目中)。这应该会产生
bin/rails

然后你可以这样做:

bin/rails c
运行控制台,或者

bin/rails s
启动服务器

© www.soinside.com 2019 - 2024. All rights reserved.