Ruby on rails “运行问题”;轨道s";

Ruby on rails “运行问题”;轨道s";,ruby-on-rails,ruby,Ruby On Rails,Ruby,我在ubuntu中运行rails s时遇到问题。当我键入rails s时,它不会启动服务器,而是会显示以下消息: kyala@ubuntu:~/depot$ rails s Usage: rails new APP_PATH [options] Options: -r, [--ruby=PATH] # Path to the Ruby binary of your choice # Default: /ho

我在ubuntu中运行
rails s
时遇到问题。当我键入
rails s
时,它不会启动服务器,而是会显示以下消息:

kyala@ubuntu:~/depot$ rails s

Usage:
  rails new APP_PATH [options]

Options:

-r, [--ruby=PATH]           # Path to the Ruby binary of your choice
                              # Default: /home/kyala/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

-d, [--database=DATABASE]   # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)enter code here
                              # Default: sqlite3

 -b, [--builder=BUILDER]     # Path to an application builder (can be a filesystem path or URL)

-m, [--template=TEMPLATE]   # Path to an application template (can be a filesystem path or URL)
      [--dev]                 # Setup the application with Gemfile pointing to your Rails 

checkout
      [--edge]                # Setup the application with Gemfile pointing to Rails 

repository

[--skip-gemfile]        # Don't create a Gemfile

 -O, [--skip-active-record]  # Skip Active Record files

 -T, [--skip-test-unit]      # Skip Test::Unit files

 -J, [--skip-prototype]      # Skip Prototype files

 -G, [--skip-git]            # Skip Git ignores and keeps


Runtime options:

-f, [--force]    # Overwrite files that already exist

-p, [--pretend]  # Run but do not make any changes

 -q, [--quiet]    # Supress status output

 -s, [--skip]     # Skip files that already exist


Rails options:

 -v, [--version]  # Show Rails version number and quit

  -h, [--help]     # Show this help message 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.

您确定rails安装在“depot”目录中吗?另外,您使用的是哪个版本的rails?

在运行rails服务器之前,您需要首先创建一个rails应用程序

例如,要创建新的应用程序调用“test_app”,请运行以下命令:

rails new test_app
创建应用程序后,您可以将cd放入目录并启动服务器:

cd test_app
rails server

我的第一个预感是,您不在rails应用程序的根目录中

但在我们的部署服务器上,我必须键入

./script/rails s
在MyRails应用程序的根文件夹中时。这有用吗? 我认为这是因为那里不知道
bin\rails

[编辑]如果这不起作用,在我看来,您根本不在rails根文件夹中(这也解释了为什么
rails s
这件事不起作用)


rails根项目将至少包含以下目录:
app、lib、config、script、

尝试使用“rails服务器”而不是缩写形式。也许是因为某种原因,你给它加了个别名。

好的,盖兹,就为了结束。。。只有当我们删除rails应用程序中的一些(主要是脚本)文件夹时,才会出现此问题。。。(可能是……意外地)。。我有这个问题,但在一个错误的应用程序文件夹中…

我在Rails 2.x应用程序中看到了类似的问题。它们在
thin
unicorn
等方面表现良好,但为了获得webrick服务器,我不得不运行
bundle exec script/server
(或者对于不太小心的
script/server
,似乎可以工作)。我不知道这里的根本问题,但这似乎让我度过了难关,因为我没有维护任何rails 2.x代码(只是运行ChiliProject 3.x等)。

我们也遇到了同样的问题

确保在脚本文件夹中运行'rails'命令,而不是不同的二进制'rails'

script/rails s
这与转到脚本文件夹并运行命令相同:

cd script
./rails s

当rails应用程序文件夹中缺少脚本文件夹时,会显示上述错误。
我刚从另一个应用程序中复制了它,它对我起了作用

检查“脚本”文件夹是否存在于您的应用程序结构中。

我也遇到了同样的问题。创建应用程序后,我忘记了运行bundle

从项目目录的根目录运行:

bundle install 

尝试重新生成桶:

rm bin/*

rake rails:update:bin
它应该会起作用

更新

对于较新的(5.2+)Rails版本,请使用

rake app:update:bin

在我自己寻找答案的过程中,我尝试了一些被证明对让
rails s
为我工作有用的东西。这导致658个文件被更改,102204个插入和149个删除

  • 通过运行
    ls
  • 运行
    git状态
  • 运行git add。
  • 运行
    git commit-m“记下要添加到github存储库中的任何更改”
  • 我试着运行
    gitpush
    gitpush master
    ,但这两种方法都不起作用,“算了吧。”我猜你不能推送属于不同文件或分支的更改
  • 这是秘密。。。出于某种奇怪的原因,我在另一个文件中工作,所以我不得不运行一个
    git pull
    YourOtherFile`。这就是一切开始变得有意义的地方
  • 现在,我运行了另一个
    git status
    ,以了解这个文件中发生了什么。有修改和未跟踪的内容
  • 接下来,
    cd返回到另一个文件中
  • 运行
    git status
    查看所有已修改和未跟踪的文件
  • 运行
    git add.
    git commit-m“将您的更改记录到此存储库”
  • 观看魔术表演,然后运行git push
  • 运行
    gem更新绑定器
  • 然后我运行了
    gem安装'rails\u 12factor'
  • 运行另一个
    git status
    查看您的修改
  • 运行git commit-m“成功添加gem rails\u 12Factor”
  • 运行git推送
  • bcrypt在3.1.11版本被锁定时出现问题,因此我运行了
    gem安装'bcrypt'
  • 再次运行
    gem安装'rails\u 12factor'
    。我相信我把“因子”中的“f”大写了
  • 运行
    gem更新
  • 运行
    gem安装pg
  • 运行git add。
  • 运行git提交-m“更新的Gemfile”
  • 运行git推送
  • 再次运行
    gem安装'pg'
  • 我遇到了各种各样的问题,但那是因为我试图将我的gemfile升级到Rails 5
  • 运行
    gem安装“railties”
  • 运行
    gem安装'activesupport'
  • 如果您的gem文件已经在另一个版本的rails中(
    gem'rails',4.2.6'
    ),请确保将其保留在那里,因为rails 5中没有显著差异

  • 我希望这有帮助

    kyala@ubuntu:~/depot$rails-v rails 3.0.7我已经创建了一个新的rails应用程序,但每次我想运行rails时,它都会给我一个信息:(哪个rails的输出是什么?
    ?这是输出
    /home/kyala/.rvm/gems/ruby-1.9.2-p290/bin/rails
    ,它给了我这个错误:
    kyala@ubuntu:~/depot$。/script/rails s bash:。/script/rails:没有这样的文件或目录
    那么你似乎在一个rails应用程序中,在一个标准的rails应用程序中,有一个
    s包含
    rails
    脚本的script
    文件夹。您可以验证您是否在rails应用程序中吗?它包含哪些文件夹?它会用相同的消息提示我。
    rails s
    rails server
    的缩写,而不是
    rails start
    。后者在任何情况下都会产生错误消息。rails 5.0.0.1 I h运行bin/rails应用程序的广告:update:bin。知道为什么吗