ruby – 无法找到耙子

前端之家收集整理的这篇文章主要介绍了ruby – 无法找到耙子前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
嘿,我玩耍捆绑和一些宝石,现在我不能使用耙子了

如果我做一个简单的db:migrate我得到这个错误

mac:app antpaw$rake db:migrate
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:335:in `bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
 from <internal:gem_prelude>:282:in `method_missing'
 from /usr/local/bin/rake:19:in `<main>'

如果我做宝石列表,耙子是列出的. im使用rails 3.0.0beta4,bundler 1.0.0.beta.5和ruby 1.9.2dev.

EDIT发布我的出口

mac:trickpipe antpaw$export
declare -x Apple_PubSub_Socket_Render="/tmp/launch-2GMaKT/Render"
declare -x COMMAND_MODE="unix2003"
declare -x DISPLAY="/tmp/launch-5RguhF/:0"
declare -x HOME="/Users/antpaw"
declare -x LC_CTYPE="UTF-8"
declare -x LOGNAME="antpaw"
declare -x OLDPWD="/Users/antpaw"
declare -x PATH="/usr/local/bin:/usr/local/sbin:/usr/local/MysqL/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin"
declare -x PWD="/Volumes/Work HD/localhost/trickpipe"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/tmp/launch-N13Ivn/Listeners"
declare -x TERM="xterm-color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="272"
declare -x TMPDIR="/var/folders/-K/-Kf7svFPHrKmLqMXKAGLuU+++TI/-Tmp-/"
declare -x USER="antpaw"
declare -x __CF_USER_TEXT_ENCODING="0x1F5:0:0"
mac:trickpipe antpaw$which ruby
/usr/local/bin/ruby
mac:trickpipe antpaw$ruby -v
ruby 1.9.2dev (2010-07-02 revision 28524) [x86_64-darwin10.2.0]

好的,我试过了,看看错误msg是如何变化的:

mac:trickpipe antpaw$export GEM_HOME="/usr/local/lib/ruby/gems"
mac:trickpipe antpaw$rake about
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:335:in `bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
    from <internal:gem_prelude>:282:in `method_missing'
    from /usr/local/bin/rake:19:in `<main>'
mac:trickpipe antpaw$export GEM_PATH="/usr/local/lib/ruby/gems"
mac:trickpipe antpaw$rake about
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rake (>= 0) (Gem::LoadError)
    from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:214:in `activate'
    from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1082:in `gem'
    from <internal:gem_prelude>:213:in `push_gem_version_on_load_path'
    from <internal:gem_prelude>:16:in `gem'
    from /usr/local/bin/rake:18:in `<main>'
mac:trickpipe antpaw$

现在用rvm:

mac:trickpipe antpaw$rake about
(in /Volumes/Work HD/localhost/rails_app)
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:30: warning: already initialized constant RAKEVERSION
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:402: warning: already initialized constant EMPTY_TASK_ARGS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:450: warning: already initialized constant EMPTY
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:958: warning: already initialized constant RUBY_EXT
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:962: warning: already initialized constant RUBY
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1031: warning: already initialized constant LN_SUPPORTED
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1240: warning: already initialized constant ARRAY_METHODS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1243: warning: already initialized constant MUST_DEFINE
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1247: warning: already initialized constant MUST_NOT_DEFINE
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1251: warning: already initialized constant SPECIAL_RETURN
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1257: warning: already initialized constant DELEGATING_METHODS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1561: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1567: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1604: warning: already initialized constant FileList
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1630: warning: already initialized constant EARLY
/Users/antpaw/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/rake.rb:1960: warning: already initialized constant DEFAULT_RAKEFILES
DEPRECATION WARNING: Calling a method in Rails::Application is deprecated,please call it directly in your application constant Trickpipe::Application. (called from method_missing at /Users/antpaw/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/rails-edb5401/railties/lib/rails/application.rb:77)
rake aborted!
stack level too deep

(See full trace by running task with --trace)

解决方法

我很确定你没有正确设置你的路径环境.
/usr/local/lib/ruby/site_ruby/1.9.1/是Mac OS X附带的RUby解释器的默认包文件夹.当你说你(假设)使用Ruby 1.9.2dev这个路径是错误的.请在shell中删除导出并发布结果.此外,请发布您的安装/打开Ruby 1.9.2dev和您的捆绑文件夹.

编辑1:

好的,您的问题的quickfix:export GEM_HOME =“/ path / where / your / gems / residence”,并可选地导出GEM_PATH =“/ path / where / your / gems / residence”,并可选地导出PATH =“/ path / where /你/宝石/驻留:$PATH”.只有在这个顺序!尝试一个,当它仍然不工作继续下一个导出.

请注意,这应该解决您的问题,但是要使Bundler环境与rails f.e您必须更改Rails应用程序的配置,以明确使用您的自定义BUndler gem环境.之前我读过Rails3将包含这个选项;在这种情况下(我不知道Rails3)检查你的这些命令.

P.s:将Bundler放在一边,并使用RVM.它更强大,更成熟,并且允许更多的灵活性(特别是在与gemsets一起处理多个口译员时).

原文链接:/ruby/270923.html

猜你在找的Ruby相关文章