2013-02-24 53 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的重新安装终于达成。它只需要大约四个小时才能正常工作: -/

相关问题