簡體   English   中英

無法訪問localhost:3000 ruby​​ on rails ubuntu

[英]Can not acces localhost:3000 ruby on rails ubuntu

我一直在嘗試通過運行命令rails srails server訪問或至少在我的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到該目錄才能啟動服務器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM