gpt4 book ai didi

ruby-on-rails - 无法访问本地主机 :3000 ruby on rails ubuntu

转载 作者:行者123 更新时间:2023-12-04 19:02:59 25 4
gpt4 key购买 nike

我一直在尝试通过运行命令 rails s 来访问或至少在 Rails 中显示我的服务器。或 rails server它不起作用:

起初它告诉我必须安装新的 gem 并运行命令 bundle install升级它们,我做到了。它“正确”地安装了所有东西。

现在,我只是得到一些使用帮助而不是 Rails(例如我可以使用的命令)。我以为 Rails 已经出局了,但我运行了命令 rails new myApp它确实为我创造了一个并且捆绑安装正常。我只想启动我的应用程序并尝试localhost:port ,然后打开我的应用程序。

当我尝试生成某些东西时也会发生同样的情况,例如 rails g model OneModel (或 generate 而不是 g )以及我想要生成的任何内容。它似乎不理解我的命令。

我对 ubuntu 很陌生,对 Rails 和 ruby​​ 还很陌生。如果你能帮助我,我会很高兴。这是我得到的输出:

agustin@agustin:~/Agustin/myapp$ rails s
Usage:
rails new APP_PATH [options]

Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /usr/bin/ruby
-b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL)
-m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL)
[--skip-gemfile] # Don't create a Gemfile
[--skip-bundle] # Don't run bundle install
-G, [--skip-git] # Skip Git ignores and keeps
-O, [--skip-active-record] # Skip Active Record files
-S, [--skip-sprockets] # Skip Sprockets files
-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] # Skip JavaScript files
[--dev] # Setup the application with Gemfile pointing to your Rails checkout
[--edge] # Setup the application with Gemfile pointing to Rails repository
-T, [--skip-test-unit] # Skip Test::Unit files
[--old-style-hash] # Force using old style hash (:foo => 'bar') on Ruby >= 1.9

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

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.

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

This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.
agustin@agustin:~/Agustin/myapp$

最佳答案

您必须运行 rails s从项目根目录。

例如,如果您创建一个 rails 应用程序,比如说 rails new my_app ,它将创建一个骨架应用程序my_app在当前目录中。现在你必须 cd到该目录以启动服务器

关于ruby-on-rails - 无法访问本地主机 :3000 ruby on rails ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28644887/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com