簡體   English   中英

嘗試執行任何以“rails”開頭的命令會產生“找不到Gemfile”

[英]attempting to execute any command starting “rails” yields “Could not locate Gemfile”

我正在嘗試安裝新的rails應用程序。 我已經在我的機器上安裝了幾個rails應用程序,一切正常。

$ rails new app
Could not locate Gemfile

然后我想我會運行一個跟蹤來弄清楚發生了什么,因為你不希望此時有一個Gemfile ,因為通常上面的命令會在一個名為app的目錄中創建一個全新的rails應用app 。該Gemfile包含的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 <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [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 gemset上安裝的gem

$ 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)

Bundler版本

$ 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

一切看起來都很好,非常沮喪,請幫忙。

只有使用前綴為bundle exec命令或在當前目錄中沒有Gemfile bundle install時才會發生此錯誤。

我的假設是您可能正在運行啟用bundler命令,請檢查:

which rake

找出運行的命令。

bundle install

在項目目錄中為我修復了它。 之后,我遇到了這個錯誤:

Gemfile中出現錯誤,Bundler無法繼續。

這是固定的:

gem update bundler

然后我重新安裝Ruby和Rails終於工作了。 它只用了大約四個小時就可以了: - /

暫無
暫無

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

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