2016-08-12 101 views
2

當我轉到rails文件夾(我在我的rails應用程序文件夾中)並鍵入「rails c」或「rails g」時,它會提示:命令:rails console,生成無法識別。錯誤:無法識別命令'rails'用法:rails COMMAND [ARGS]

錯誤:命令 '軌道' 無法識別

用法:rails命令[參數]

Usage: spring COMMAND [ARGS]                              

Commands for spring itself:                              

    binstub   Generate spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert.     
    help   Print available commands.                          
    server   Explicitly start a Spring server in the foreground                    
    status   Show current status.                           
    stop   Stop all spring processes for this project.                      

Commands for your application:                             

    rails   Run a rails command. The following sub commands will use spring: console, runner, generate, destroy, test.      
    rake   Runs the rake command                           
Error: Command 'rails' not recognized                            
Usage: rails COMMAND [ARGS]                              

The most common rails commands are:                            
generate Generate new code (short-cut alias: "g")                        
console  Start the Rails console (short-cut alias: "c")                      
server  Start the Rails server (short-cut alias: "s")                      
dbconsole Start a console for the database specified in config/database.yml                 
      (short-cut alias: "db")                            
new   Create a new Rails application. "rails new my_app" creates a                   
      new application called MyApp in "./my_app"                       

In addition to those, there are:                             
destroy  Undo code generated with "generate" (short-cut alias: "d")                   
plugin new Generates skeleton for developing a Rails plugin                     
runner  Run a piece of code in the application environment (short-cut alias: "r")               

All commands can be run with -h (or --help) for more information. 

我運行Linux子系統用於Windows 10,我知道,我知道你看到的Windows,但它是一種.. 。Linux,我用rbenv通過this tutorial安裝了Ruby。

+0

好的,我會嘗試。但我仍然可以通過「rails新應用程序」創建項目? – truongnm

+1

這可能會幫助你http://stackoverflow.com/questions/21608744/rails-command-error –

回答

6

從您的app文件夾試試這個命令:

rake rails:update:bin 

比如Y更換二進制文件。

我在Windows Linux子系統上使用rails時遇到了同樣的問題。我發現這裏的建議:

Rails command Error

我嘗試過了,它解決了我的問題,所以也許你也是如此。

+0

非常感謝!那幫助了男人 – Liker777

相關問題