错误:“找不到耙”,但安装耙(Error: “Could not find rake”, yet R

2019-09-18 08:56发布

为什么我收到此错误耙:

$ rake --version
/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rake (>= 0) amongst [] (Gem::LoadError)
    from /Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin/rake:18:in `<main>'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

考虑到以下情况:

$ gem list

*** LOCAL GEMS ***

bundler (1.1.3)
rake (0.9.2.2)
rubygems-bundler (1.0.2)
rvm (1.11.3.3)
$ which rake
/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin/rake

具体做法是:在此错误消息的错误而产生,或从配置问题 (并且如果是后者,那么其步骤可能补救)?


更新:按要求附加终端的输出:

$ which gem
/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/bin/gem
$ whereis rake
/usr/bin/rake
$ echo $PATH # I've edited the output as one item per line for easier reading
/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin:
/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194@global/bin:
/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/bin:
/Volumes/Data/sampablokuper/.rvm/bin:
/opt/local/bin:
/opt/local/sbin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/bin:
/usr/texbin:
/usr/X11/bin:
/usr/local/git/bin:
/Library/Application Support/VMware Fusion:
/Volumes/Data/sampablokuper/bin:
/Volumes/Data/sampablokuper/.rvm/bin
$ type rvm | head -n1
rvm is a function
$ rvm info

ruby-1.9.3-p194:

  system:
    uname:       "Darwin spksmb.lan 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.14.3 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "9 hours 36 minutes 53 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "x86_64-darwin10.8.0"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0]"

  homes:
    gem:          "/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194"
    ruby:         "/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194"

  binaries:
    ruby:         "/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin/rake"

  environment:
    PATH:         "/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin:/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194@global/bin:/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/bin:/Volumes/Data/sampablokuper/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/local/git/bin:/Library/Application Support/VMware Fusion:/Volumes/Data/sampablokuper/bin"
    GEM_HOME:     "/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194"
    GEM_PATH:     "/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194:/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

Answer 1:

该“whereis”二进制检查一组由user.cs_path变量设置系统默认路径(见sysctl -a | grep user.cs_path ),而不是实际的$ PATH变量。 因此,报道了“耙”的位置永远是无论发生什么事要在该组的路径,而不是实际的一个使用的,除非真正确实发生要安装的系统,因此不会显示在$ PATH上来就耙。

请运行

which rake

看到的是实际使用该前角。 如果报告在/ usr / bin中/耙,而不是一些路径,如/Users/me/.rvm/gems/ruby-1.9.3-p194@global/bin/rake话,肯定什么是错的。

请包括

rvm info

输出并确保

type rvm | head -n1

报告“RVM是一个函数”。 如果报告比其他任何东西,你的安装被搞砸了,在这种情况下,你应该删除您的RVM安装使用rvm implode ,注销完全,然后做RVM的完全重新安装。 是的,注销步骤是非常重要的。



Answer 2:

它看起来好像这个问题是存在的,因为存在的,在从中我正在执行一个文件称为在问题中所示的命令时,该目录Gemfile具有以下内容:

source 'https://rubygems.org'

gemspec

删除或重命名该文件会产生以下(耶!):

$ rake --version
rake, version 0.9.2.2

相反,保持的Gemfile,但删除或重命名myproject.gemspec从目录文件得到这样的:

$ rake --version
/Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/dsl.rb:48:in `gemspec': There are no gemspecs at /Volumes/Data/spikes/myproject. (Bundler::InvalidOption)
    from /Volumes/Data/spikes/myproject/Gemfile:4:in `evaluate'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/dsl.rb:7:in `instance_eval'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/dsl.rb:7:in `evaluate'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/definition.rb:18:in `build'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler.rb:135:in `definition'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler.rb:123:in `load'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:60:in `setup'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:75:in `<top (required)>'
    from /Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
    from /Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
    from /Volumes/Data/sampablokuper/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /Volumes/Data/sampablokuper/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:9:in `<main>'

该行为的事实rake --version如此强烈的存在/不存在影响/这些文件的内容不打我的错误,我会进行相应的提交错误报告。



文章来源: Error: “Could not find rake”, yet Rake is installed