2013-02-24 52 views
3

我想安裝一個新的導軌應用程序。我的機器上已經有了幾個Rails應用程序,一切正常。試圖執行任何命令啓動「導軌」產量「找不到Gemfile」

$ rails new app 
Could not locate Gemfile 

然後,我想我會運行跟蹤來找出發生了什麼事情,因爲你不會期望有一個Gemfile在這一點上,無論如何,因爲通常上面的命令將創建一個全新的軌道應用程序在名爲app的目錄中,該目錄中包含Gemfile

$ rails new app --trace 
Could not locate Gemfile 

所以,我想通過這個詳細的指南,重新安裝在我的電腦上的所有內容:

http://railsapps.github.com/installing-rails.html#gems

後第一個20個左右的步驟,我得到了這個命令:

$ rake -v 
Could not locate Gemfile 

我假設我的設置在某個地方有些東西沒有關閉,但我什麼都看不到。

這裏是我的RVM設置:

$ rvm version 

rvm 1.18.10 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] 

$ rvm list 

rvm rubies 

    jruby-1.6.7 [ x86_64 ] 
    ruby-1.9.1-p431 [ i386 ] 
    ruby-1.9.3-p194 [ x86_64 ] 
    ruby-1.9.3-p286 [ x86_64 ] 
    ruby-1.9.3-p327 [ x86_64 ] 
=* ruby-1.9.3-p385 [ x86_64 ] 

# => - current 
# =* - current && default 
# * - default 

$ rvm gemset list 

gemsets for ruby-1.9.3-p385 (found in /Users/paul/.rvm/gems/ruby-1.9.3-p385) 
    (default) 
    global 
=> rails32 

這裏我rails32寶石安裝在寶石

$ gem list 

*** LOCAL GEMS *** 

actionmailer (3.2.12, 3.2.11) 
actionpack (3.2.12, 3.2.11) 
activemodel (3.2.12, 3.2.11) 
activerecord (3.2.12, 3.2.11) 
activeresource (3.2.12, 3.2.11) 
activesupport (3.2.12, 3.2.11) 
arel (3.0.2) 
builder (3.0.4) 
bundler (1.2.4) 
erubis (2.7.0) 
hike (1.2.1) 
i18n (0.6.1) 
journey (1.0.4) 
json (1.7.7) 
mail (2.4.4) 
mime-types (1.21) 
multi_json (1.6.1) 
polyglot (0.3.3) 
rack (1.4.5) 
rack-cache (1.2) 
rack-ssl (1.3.3) 
rack-test (0.6.2) 
rails (3.2.12, 3.2.11) 
railties (3.2.12, 3.2.11) 
rake (10.0.3) 
rdoc (3.12.1) 
rubygems-bundler (1.1.0) 
rvm (1.11.3.6) 
sprockets (2.2.2) 
thor (0.17.0) 
tilt (1.3.3) 
treetop (1.4.12) 
tzinfo (0.3.35) 

捆紮機版本

$ bundle --version 
Bundler version 1.2.4 

.gemrc文件

$ cat ~/.gemrc 
--- 
:backtrace: false 
:benchmark: false 
:bulk_threshold: 1000 
:sources: 
- http://rubygems.org/ 
- https://rubygems.org 
:update_sources: true 
:verbose: true 

一切似乎都很好,很沮喪,請幫忙。

+0

您是否像'rails -v'或'rails -h'一樣得到相同的錯誤? – Cluster 2013-02-24 02:48:54

+0

@Cluster不幸的是,我得到了同樣的結果。有任何想法嗎? – 2013-02-24 05:32:53

+0

如果你在這些命令之前加上'bundle exec',那麼怎麼辦? – Cluster 2013-02-24 05:37:24

回答

9

這個錯誤只發生在前綴爲bundle exec的命令或bundle install而沒有Gemfile的當前目錄中。

我的假設是,你可能會運行,使bundler命令,檢查:

which rake 

找出命令運行什麼。

+4

謝謝!我在我的.bash_profile中將'bundle exec rails'別名替換爲'rails',您的評論讓我們非常容易地弄清楚發生了什麼。 – 2013-02-24 17:49:40

+2

這也是我所做的。對於那些想爲那個shell會話重寫別名的人,你可以這樣做:alias rails ='rails'。 – Rystraum 2013-07-11 19:42:36

0
bundle install 

在項目目錄中爲我修好了。 在那之後,我就遇到了這個錯誤:

There was an error in your Gemfile, and Bundler cannot continue.

,這是固定的:

gem update bundler 

然後我的Ruby和Rails的重新安裝終於達成。它只需要大約四個小時才能正常工作: -/

相關問題