2013-12-13 28 views
1

我在Desktop/rails_projects下初始化新的Rails應用程序時遇到問題。根據另一篇文章,我必須清空受影響的目錄,這阻止了我創建一個新項目。這個帖子說如果我用ls -a找內部,我會找到.bundle folderRuby on Rails錯誤:無法在另一個目錄中初始化新的Rails應用程序,請首先更改爲非Rails目錄

但是,我的問題是我在創建一個新的Rails應用程序之前創建了rails_projects,這意味着什麼都沒有。另外,我試過在Desktop/aNewFolder下創建了另一個文件夾,同樣的事情發生。也許桌面本身存在問題?我不確定。我在Desktop上做過ls -a,但是我找不到.bundle folder.另外,我不能僅僅刪除桌面上的所有內容。這太荒謬了。

這是我有什麼,當我試圖做$rails new first_appDesktop/rails_projects

Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first. 
Type 'rails' for help. 

而且收到此當我輸入軌:

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: 
application Generate the Rails application code 
destroy  Undo code generated with "generate" (short-cut alias: "d") 
benchmarker See how fast a piece of code runs 
profiler  Get profile information from a piece of code 
plugin  Install a 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. 

非常感謝你的幫助! !

+0

類型'軌道控制檯'...它嘗試打開控制檯嗎? – tyler

回答

1

首先在rails_projects下創建一個目錄,mkdir first_app,然後運行你的rails new first_app命令。

如果first_app已經存在,請先將其刪除或選取其他目錄/應用程序名稱。

+1

再次感謝您的建議。我試圖在Desktop/rails_projects/projects /下創建一個新目錄。但是,它仍然導致了同樣的問題。所以我嘗試在其他根文件夾(例如Document或〜/下)中創建一個新文件夾或Rails應用程序,並且它工作正常。儘管我現在可以開發一個Ruby應用程序,但我無法在桌面下創建任何內容。我希望有這個問題的解決方案? – wag0325

2

就我而言,我意識到項目結構中的所有文件都是在用戶C:\Users\Sergio下創建的。應用程序文件夾,bin,config,db,lib,日誌,公共,測試,tmp和供應商。 這種情況下的解決方案是刪除文件,aptana開始正常工作。

-1

enter image description here(同樣的問題)其實我有這樣的問題。

現在我得到了解決這個問題的方法。 我希望你能用我的解決方案解決這個問題。

enter image description here

(look at this while reading below solutions)

  1. look at your command(bash) If the current position "yourId:~/workspace", Go to the preceding folder ->"cd .."
  2. "ls" -> input in your command again. then you can see like this Three-file. (check-invironment*, lib/, workspace/)
  3. The reason your project was not operated is about the directory "workspace". so you MUST REMOVE YOUR "WORKSPACE" directory. ->"rm -rf workspace/"
  4. check whether the folder is deleted. ->"ls" again.
  5. if you removed the "workspace", you'll see the TWO THIGS (check-invironment*, lib/)
  6. after removing, make a new workspace again. ->"mkdir workspace"
  7. now you can make the new app. ->"rails new appname_you_want" or "rails 5.0.0.1 new appname_you_want"
相關問題