rails不能使用我的应用程序

时间:2016-03-21 06:44:54

标签: ruby-on-rails terminal

嘿伙计们我一直在使用rails应用程序,而rails服务器正在运行。然后我添加了更多代码,突然之间rails服务器现在无法正常工作。我一直收到这条消息:

Usage:


rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                         # Default: /Users/ethanfranson/.rvm/rubies/ruby-2.2.1/bin/ruby
  -m, [--template=TEMPLATE]                              # Path to some application template (can be a filesystem path or URL)
      [--skip-gemfile], [--no-skip-gemfile]              # Don't create a Gemfile
  -B, [--skip-bundle], [--no-skip-bundle]                # Don't run bundle install
  -G, [--skip-git], [--no-skip-git]                      # Skip .gitignore file
      [--skip-keeps], [--no-skip-keeps]                  # Skip source control .keep files
  -O, [--skip-active-record], [--no-skip-active-record]  # Skip Active Record files
  -S, [--skip-sprockets], [--no-skip-sprockets]          # Skip Sprockets files
      [--skip-spring], [--no-skip-spring]                # Don't install Spring application preloader
  -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], [--no-skip-javascript]        # Skip JavaScript files
      [--dev], [--no-dev]                                # Setup the application with Gemfile pointing to your Rails checkout
      [--edge], [--no-edge]                              # Setup the application with Gemfile pointing to Rails repository
      [--skip-turbolinks], [--no-skip-turbolinks]        # Skip turbolinks gem
  -T, [--skip-test-unit], [--no-skip-test-unit]          # Skip Test::Unit files
      [--rc=RC]                                          # Path to file containing extra configuration options for rails command
      [--no-rc], [--no-no-rc]                            # Skip loading of extra configuration options from .railsrc file

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

Rails options:
  -h, [--help], [--no-help]        # Show this help message and quit
  -v, [--version], [--no-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

我的应用程序名为bloccit,在我的终端shell中,我在我的代码/ bloccit目录中,但仍然没有。如果有人可以提供任何帮助,我将非常感激!

3 个答案:

答案 0 :(得分:1)

rails s运行位于应用bin目录中的脚本。没有它,您将收到上面显示的消息。

我询问了你的app目录的内容(使用ls),你回复了:

Gemfile Rakefile config.ru log tmp Gemfile.lock 
app db public vendor README.md config lib spec 

如您所见,您的bin目录丢失了。必须恢复/更换。

如果您将其移动或将其扔进垃圾箱,请将其恢复。

如果您删除了它,则可以从另一个/新的Rails应用程序中复制一个。在现有应用程序之外的某个位置创建一个文件夹,生成一个空的Rails应用程序(rails new throwaway),然后进入并将bin文件夹复制到现有应用程序。

答案 1 :(得分:0)

确保您位于根应用程序目录中。如果您不在根应用程序目录中,则通常会看到您发布的错误。

您可以使用pwd命令显示当前目录的位置。您说您的应用名称为bloccit,您应该在该根目录中并触发rails s

答案 2 :(得分:0)

它可能会建议您创建一个新的rails应用程序,因为它无法识别您的Rails应用程序。 由于您使用的是Rails版本4.x,因此它会查找bin / rails以识别Rails应用程序。如果您的应用程序根目录中没有bin目录,请尝试运行rake rails:update:bin

相关问题