试图执行任何启动"rails"的命令.产生“无法找到Gemfile". [英] attempting to execute any command starting "rails" yields "Could not locate Gemfile"

查看:101
本文介绍了试图执行任何启动"rails"的命令.产生“无法找到Gemfile".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装新的Rails应用.我的机器上已经有几个Rails应用程序,都运行良好.

I am trying to install a new rails app. I've already got several rails apps on my machine, all working fine.

$ rails new app
Could not locate Gemfile

然后我想我会进行跟踪以弄清楚发生了什么,因为无论如何您现在都不会期望Gemfile,因为通常上述命令会在其中创建一个全新的Rails应用程序一个名为app的目录,该目录中包含Gemfile.

Then I figured I'd run a trace to figure out what was going on, as you wouldn't expect to have a Gemfile at this point anyway, as typically the above command would create an entire new rails app in a directory named app with the Gemfile contained within that directory.

$ rails new app --trace
Could not locate Gemfile

因此,我尝试通过此详细指南重新安装计算机上的所有内容:

So I tried to reinstall everything on my computer via this detailed guide:

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

经过大约20个步骤之后,我执行了以下命令:

After the first 20 or so steps, I got to this command:

$ rake -v
Could not locate Gemfile

我认为某处的设置有问题,但看不到任何问题.

I assume something is off on my setup somewhere, but I can't see anything off.

这是我的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上安装的宝石

Here are the gems installed on my rails32 gemset

$ 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

一切似乎都很好,很沮丧,请帮忙.

Everything seems to look fine, very frustrated, please help.

推荐答案

仅在前缀为的命令或在当前目录中没有Gemfilebundle install的命令中,才会发生此错误.

This errors happens only with commands prefixed with bundle exec or for bundle install without Gemfile in current dir.

我的假设是您可能正在运行启用bundler的命令,请检查:

My assumption is you might be running commands that enable bundler, check:

which rake

找出正在运行的命令.

这篇关于试图执行任何启动"rails"的命令.产生“无法找到Gemfile".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆