安装 ruby​​ gems 后,运行新 gem 返回“找不到"错误 [英] After installing ruby gems, running the new gem returns "Could not find" errors

查看:29
本文介绍了安装 ruby​​ gems 后,运行新 gem 返回“找不到"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全新 Ubuntu 10.04 安装:

Fresh Ubuntu 10.04 install:

我在让我的 gem 安装过程正常运行时遇到了一些麻烦.每当我安装 gem 时,它都会经历一个很好、直接的过程,没有任何问题:

I'm having some trouble getting my gem install process to play nicely. Any time I install a gem, it goes through a nice, straightforward process with no problems:

$ gem install rails
Successfully installed rails-3.2.2
1 gem installed

然后验证版本,也许是一个简单的rails -v"?没有:

And then to verify the version, perhaps a simple "rails -v"? Nope:

$ rails -v
/home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin/rails:18:in `<main>'

所以让我们确保安装 railties:

So let's make sure railties is installed:

$ gem install railties
Successfully installed railties-3.2.2
1 gem installed

并尝试再次获取 rails 的版本:

And try to get the version of rails again:

$ rails -v
/home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin/rails:18:in `<main>'

我安装的几乎所有 gem 都会发生这种情况.我尝试搜索某种关于如何使用 gem 安装东西的文档,但找不到任何东西.似乎有些 gem 安装在一个位置,有些则安装在另一个位置,而其中一个位置不在我的路径中.有什么想法吗?

This happens with nearly every gem I install. I tried searching for some sort of documentation of how things are installed with gem, but couldn't find anything. It seems as though some gems are installed in one location, and some in another, and one of those locations is not in my path. Any ideas what's going on here?

要求的信息:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.17
  - RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/pragone/.rvm/gems/ruby-1.9.3-p125
  - RUBY EXECUTABLE: /home/pragone/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
  - EXECUTABLE DIRECTORY: /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/pragone/.rvm/gems/ruby-1.9.3-p125
     - /home/pragone/.rvm/gems/ruby-1.9.3-p125@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - http://rubygems.org/

还有 rvm 信息:

system:

  system:
    uname:       "Linux domU-12-31-39-0A-34-6E 2.6.32-311-ec2 #23-Ubuntu SMP Thu Dec 2 11:14:35 UTC 2010 x86_64 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.10.3 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/]"
    updated:      "2 hours 40 minutes 7 seconds ago"

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         "/usr/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/bin/gem"
    rake:         "/home/pragone/.rvm/bin/rake"

  environment:
    PATH:         "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/pragone/.rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""

此外,使用上面列出的 PATH,我在尝试运行 rails 时得到了这个:

Additionally, with the above listed PATH, I get this when trying to run rails:

The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

但是,当我四处乱窜并将这些错误添加到我的 PATH 时,发生了上述错误:

However, the aforementioned errors occurred when I was hacking around and added these to my PATH:

/home/pragone/.rvm/gems/ruby-1.9.3-p125/bin
/home/pragone/.rvm/gems/ruby-1.9.3-p125/gems

我尝试重新运行 ~/.rvm/scripts/rvm,但它似乎没有将正确的路径添加到我的 PATH.我还在工作安装(我的 macbook pro,运行 os x 10.7)上做了一些挑选,并验证 ~/.rvm/scripts/rvm 在工作安装中将项目添加到我的 PATH 中,但不是在ubuntu 盒子.

I've tried re-running ~/.rvm/scripts/rvm, but it doesn't seem like it's adding the correct paths to my PATH. I've also done some picking around on a working-install (my macbook pro, running os x 10.7), and verified that ~/.rvm/scripts/rvm is adding items to my PATH in the working install, but not on the ubuntu box.

which rails:被黑的路径:

$ which rails
/home/pragone/.rvm/gems/ruby-1.9.3-p125/bin/rails

which rails:新鲜的 PATH:(没有响应;大概没有找到)

which rails: fresh PATH: (no response; presumably not found)

$ which rails
$

推荐答案

好像缺少的链接是

$ rvm use ruby-1.9.3-p125 --default

好像已经解决了.

PS:谢谢你看这个.为了您的娱乐,如果您还没有在 HN 上看到它(它是 python,但仍然很好笑):https://gist.github.com/289467

PS: Thanks for looking at this. For your entertainment, if you didn't see it on HN yet (it's python, but still a good chuckle): https://gist.github.com/289467

这篇关于安装 ruby​​ gems 后,运行新 gem 返回“找不到"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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