Ruby on rails “运行问题”;轨道s";
我在ubuntu中运行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
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 commit-m“记下要添加到github存储库中的任何更改”
gitpush
和gitpush master
,但这两种方法都不起作用,“算了吧。”我猜你不能推送属于不同文件或分支的更改git pull
YourOtherFile`。这就是一切开始变得有意义的地方git status
,以了解这个文件中发生了什么。有修改和未跟踪的内容cd返回到另一个文件中
git status
查看所有已修改和未跟踪的文件git add.
和git commit-m“将您的更改记录到此存储库”
gem更新绑定器
gem安装'rails\u 12factor'
git status
查看您的修改
gem安装'bcrypt'
gem安装'rails\u 12factor'
。我相信我把“因子”中的“f”大写了gem更新
gem安装pg
gem安装'pg'
gem安装“railties”
gem安装'activesupport'
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。知道为什么吗