我一直试图通过运行命令rails s
或rails server
来访问或至少在我的Rails中显示我的服务器,但它不起作用:
起初它告诉我必须安装新宝石并运行命令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$
答案 0 :(得分:2)
您必须从项目根目录运行rails s
。
例如,如果您创建一个rails应用程序,比如rails new my_app
,它将在当前目录中创建一个框架应用程序my_app
。现在您必须cd
到该目录才能启动服务器