2011-09-25 134 views
9

我有在Ubuntu上運行rails s問題。當我鍵入rails s它不會啓動服務器,而是它給了我這個消息:問題上運行「軌道的」

[email protected]:~/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. 

回答

0

確定導軌安裝在「庫」目錄?另外,您使用的是哪種版本的導軌?

+0

kyala @ Ubuntu的:〜/庫$軌-v 的Rails 3.0.7 –

+0

即時通訊使用的版本3.0.7 –

3

運行Rails服務器之前,你需要先創建一個Rails應用程序。

例如,創建一個新的應用程序調用「test_app」,運行以下命令:

rails new test_app 

一旦你的應用程序創建,您可以cd到該目錄,並啓動服務器:

cd test_app 
rails server 
+0

我已經創建了一個新的Rails應用程序,但每次我想運行軌道的IT給我那個消息時:( –

+0

我已經創建了「depot」 –

+0

'which rails'的輸出是什麼? – rdvdijk

2

我的第一個預感是你不在你的rails應用程序的根目錄。

oBut在我們的部署服務器,我必須鍵入

./script/rails s 

在我的Rails應用程序的根文件夾時。這有幫助嗎? 我認爲這是因爲bin\rails在那裏是不知道的。

[編輯]如果這不起作用,在我看來,你根本不在一個軌道根文件夾(這也可以解釋爲什麼rails s事情不起作用)。

一個Rails根項目將至少包含以下目錄:app, lib, config, script, ...

+0

它給了我這個錯誤:'kyala @ ubuntu:〜/ depot $ ./script/rails s bash:./script/rails:沒有這樣的文件或目錄' –

+0

然後它看起來像你在一個rails應用程序中,在一個標準的rails應用程序中,有一個包含'rails'腳本的'script'文件夾如果你是在一個軌道應用程序?它包含哪些文件夾? – nathanvda

-1

試試「軌服務器」,而不是短期的形式。也許你有它的別名出於某種原因。

+0

它也沒有工作:( –

+0

它促使我提供了相同的消息 –

+0

'rails s'是'rails server'的簡稱,而不是'rails start',後者在任何情況下都會產生錯誤消息 –

2

確定guyz只是關閉......當我們在Rails應用程序刪除一些(主要是腳本)文件夾...只出現此問題(可能是意外..)..我有這個問題,但在一個錯誤的app文件夾...

0

我已經看到了使用Rails 2.x的應用程序類似的問題。他們火了細跟thinunicorn等,但得到的只是WEBrick服務器我已經跑bundle exec script/server(或對於不太認真script/server似乎工作)。我不知道在這裏玩的根本問題,但這似乎讓我感到厭煩,因爲我沒有維護任何rails 2.x代碼(只需運行ChiliProject 3.x等)。

0

我們遇到了同樣的問題。

確保您在運行該腳本文件夾中的「軌道」命令,而不是二進制「軌道」是不同的

script/rails s 

It's一樣,如果你去你的腳本文件夾,然後運行命令:

cd script 
./rails s 
6

當rails應用程序文件夾中缺少腳本文件夾時,它顯示上述錯誤。 我剛從另一個應用程序coppied它和它的工作對我來說

0

檢查你的應用程序結構中是否存在「腳本」文件夾中。

0

我有同樣的問題。我忘了在創建應用程序後運行包。

從項目目錄下運行的根源:

bundle install 
7

努力重建binstubs:

rm bin/* 

rake rails:update:bin 

它應該做的伎倆。

+0

Rails 5.0.0.1我必須運行bin/rails應用程序:update:bin 任何想法爲什麼會發生這種情況?我創建了一個新的分支,檢查了它,做了一些工作,回到了主人身邊,突然間我無法運行rails服務器不再。 – rmcsharry

0

在我自己尋找答案時,我最終嘗試了一些事情,證明rails s爲我工作是有用的。這導致更改了658個文件,102204個插入和149個刪除。

  1. 看看,你在運行ls
  2. 運行git status
  3. 運行git add .
  4. 運行git commit -m "Notate whatever changes you are adding to github repository"
  5. 我試圖運行git pushgit push master但既不工作,文件 「去圖」。我的猜測是,你無法推送屬於不同文件或分支的更改。
  6. 這裏是祕密......出於某種奇怪的原因,我在一個不同的文件中工作,所以我必須運行一個git pull YourOtherFile`。這是一切開始有意義的地方。
  7. 現在,我跑了另一個git status瞭解這個文件中發生了什麼。有修改和未跟蹤的內容。
  8. 接下來,cd back into the other file
  9. 運行git status查看所有的修改和未跟蹤文件
  10. 運行git add .git commit -m "Notate your changes to this repository"
  11. 觀看神奇的結果,那麼運行git push
  12. 運行gem update bundler
  13. 然後我跑gem install 'rails_12factor'
  14. 運行另一個git status查看您的修改
  15. 運行git commit -m "Successfully added gem rails_12Factor"
  16. 運行git push
  17. 曾與bcrypt問題被鎖定在3.1.11所以我跑gem install 'bcrypt'
  18. 運行gem install 'rails_12factor'又一次。相信我曾在 「要素」 中的 「F」 大寫
  19. 運行gem update
  20. 運行gem install pg
  21. 運行git add .
  22. 運行git commit -m "Updated Gemfile"
  23. 運行混帳推
  24. 運行gem install 'pg'再次
  25. 我遇到了各種問題,但這是因爲我試圖將我的gemfile升級到Rails 5
  26. 運行gem install 'railties'
  27. 運行gem install 'activesupport'
  28. 如果您的Gemfile已經在軌的另一個版本(gem 'rails', '4.2.6'),請確保你把它那裏有沒有對Rails 5

我一個顯著差異希望這可以幫助!