简体   繁体   English

rails-启动服务器时出现问题

[英]rails - problem starting the server

I'm trying to start the server on a rails app. 我正在尝试在Rails应用程序上启动服务器。 with some apps it works fine, others I get this message: 某些应用程序运行良好,其他应用程序则显示以下消息:

rails s
Usage:
  rails new APP_PATH [options]

Options:
      [--skip-gemfile]        # Don't create a Gemfile
  -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
      [--dev]                 # Setup the application with Gemfile pointing to your Rails checkout
  -J, [--skip-prototype]      # Skip Prototype files
  -T, [--skip-test-unit]      # Skip Test::Unit files
  -G, [--skip-git]            # Skip Git ignores and keeps
  -r, [--ruby=PATH]           # Path to the Ruby binary of your choice
                              # Default: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  -m, [--template=TEMPLATE]   # Path to an application template (can be a filesystem path or URL)
  -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:
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes

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

I'm using Rails 3.0.3 and ruby 1.8.7 我正在使用Rails 3.0.3和ruby 1.8.7

I think you are trying to run Rails 2.x applications with this command. 我认为您正在尝试使用此命令运行Rails 2.x应用程序。 It will fail with this message. 它将失败,并显示此消息。 Since its consistently failing on certain apps, check if they are rails 2.x apps. 由于它在某些应用程序上始终无法运行,因此请检查它们是否是Rails 2.x应用程序。

You can only run Rails 3.x applications with this command. 您只能使用此命令运行Rails 3.x应用程序。

You must be missing script/rails file. 您必须缺少script/rails文件。 Maybe you removed it by accident, or did something wrong while upgrading from Rails 2. Just copy it from a working project (or a new one). 也许您是无意中删除了它,或者从Rails 2升级时做错了什么。只需从正在运行的项目(或新项目)中复制它即可。

I had the same issue. 我遇到过同样的问题。 I figured out the problem was created by deleting rails 4.0.0beta1 from my system. 我发现问题是由从系统中删除rails 4.0.0beta1造成的。 I still had version 3.2 installed but I think the deletion deleted the scripts folder as well. 我仍然安装了3.2版,但我认为删除操作也删除了scripts文件夹。 After typing 输入后

gem install rails

It worked again. 它再次起作用。 Maybe this helps someone. 也许这可以帮助某人。

My guess is that you are including a character after the 's'. 我的猜测是您在's'之后加入一个字符。 If you type "Rails s" it will work but not if you type "Rails s ". 如果您输入“ Rails s”,它将起作用,但是如果您输入“ Rails s”,则它将无效。

It is consistent with which apps work and which apps do not work? 这与哪些应用程序可以工作以及哪些应用程序不能工作相一致?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM