从rvm切换到系统ruby使我无法访问宝石

时间:2011-08-15 01:11:39

标签: ruby rubygems rvm bundle

我今天从rvm切换到使用系统ruby,我不得不在我的项目目录中重新运行bundle,这并不奇怪。但在这之后,我再也无法通过命令行访问gems了。

例如:即使在其捆绑中包含rspec的项目中,rspec规范也不再有效。当我检查rspec的位置时,它仍然在.rvm目录中:

$ gem which rspec
/Users/jeremysmith/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rspec-2.6.0/lib/rspec.rb

我已经检查了$ GEM_HOME,但它没有设置为任何内容。

更新:

我通过运行:

切换回系统ruby
rvm use system

当我尝试

bundle exec rspec spec

我得到另一个即使安装了也找不到的宝石:

uninitialized constant Object::Rack (NameError)

RVM调试:

system:

rvm 1.2.8 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

system:

  system:
    uname:       "Darwin JJSMacPro.local 11.0.0 Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64 x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
    zsh:         "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"

  rvm:
    version:      "rvm 1.2.8 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

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

  binaries:
    ruby:         "/usr/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/bin/gem"
    rake:         "/usr/bin/rake"

  environment:
    PATH:         "/sw/bin:/sw/sbin:/sw2/bin:/sw2/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/X11R6/bin:/Developer/usr/bin/:/usr/local/sbin:/Users/jeremysmith/.rvm/bin:/Users/jeremysmith/.rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""
  PATH:
/sw/bin:/sw/sbin:/sw2/bin:/sw2/sbin:/usr/bin
  uname -a: Darwin JJSMacPro.local 11.0.0 Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64 x86_64
  permissions: /Users/jeremysmith/.rvm:
total 32
drwxr-xr-x  23 jeremysmith  staff   782 Aug 14 13:52 .
drwxr-xr-x+ 94 jeremysmith  staff  3196 Aug 12 10:19 ..
-rw-r--r--   1 jeremysmith  staff   566 Mar  3 11:34 LICENCE
-rw-r--r--   1 jeremysmith  staff  7986 Mar  3 11:34 README
-rw-r--r--   1 jeremysmith  staff     6 Mar  3 11:34 VERSION
drwxr-xr-x   5 jeremysmith  staff   170 Aug 14 13:45 archives
drwxr-xr-x  32 jeremysmith  staff  1088 Aug 14 14:40 bin
drwxr-xr-x   8 jeremysmith  staff   272 Aug 14 14:40 config
drwxr-xr-x   5 jeremysmith  staff   170 Aug 14 13:51 environments
drwxr-xr-x   3 jeremysmith  staff   102 Feb 19 15:36 examples
drwxr-xr-x  10 jeremysmith  staff   340 Aug 14 14:36 gems
drwxr-xr-x   8 jeremysmith  staff   272 Feb 19 15:36 gemsets
drwxr-xr-x  39 jeremysmith  staff  1326 Feb 19 15:36 help
drwxr-xr-x   4 jeremysmith  staff   136 Feb 19 15:36 lib
drwxr-xr-x   8 jeremysmith  staff   272 Aug 14 14:36 log
drwxr-xr-x   5 jeremysmith  staff   170 Feb 19 15:36 patches
drwxr-xr-x   3 jeremysmith  staff   102 Aug 14 13:52 repos
drwxr-xr-x   6 jeremysmith  staff   204 Aug 14 14:40 rubies
drwxr-xr-x  56 jeremysmith  staff  1904 Mar  3 11:34 scripts
drwxr-xr-x   8 jeremysmith  staff   272 Aug 14 14:36 src
drwxr-xr-x   2 jeremysmith  staff    68 Mar  3 11:36 tmp
drwxr-xr-x   4 jeremysmith  staff   136 Aug  9 21:01 user
drwxr-xr-x   7 jeremysmith  staff   238 Aug 14 13:51 wrappers

/Users/jeremysmith/.rvm/rubies:
total 8
drwxr-xr-x   6 jeremysmith  staff  204 Aug 14 14:40 .
drwxr-xr-x  23 jeremysmith  staff  782 Aug 14 13:52 ..
lrwxr-xr-x   1 jeremysmith  staff   46 Mar  3 11:42 default -> /Users/jeremysmith/.rvm/rubies/ruby-1.9.2-p180
drwxr-xr-x   4 jeremysmith  staff  136 Aug 14 13:50 macruby-0.9-HEAD
drwxr-xr-x   4 jeremysmith  staff  136 Aug 14 14:36 macruby-0.9-trunk
drwxr-xr-x   8 jeremysmith  staff  272 Jun 11 23:46 ruby-1.9.2-p180

  uname -r: 11.0.0
  uname -m: x86_64
  sw_vers: ProductName: Mac OS X,ProductVersion:    10.7,BuildVersion:  11A511,
  ARCHFLAGS: 
  LDFLAGS: 
  CFLAGS: 
  /Developer/SDKs/*:MacOSX10.6.sdk,MacOSX10.7.sdk,

/Users/jeremysmith/.bashrc:

/Users/jeremysmith/.bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
/Users/jeremysmith/.rvm/config/alias \(filtered\):
default=ruby-1.9.2-p180

/Users/jeremysmith/.rvm/config/db \(filtered\):
#General
niceness=0
# Rubies
interpreter=ruby
ruby_version=1.8.7
ruby_configure_flags=--enable-shared --disable-install-doc
ruby_patchlevel=299
ruby_configure=--enable-shared
ruby_repo_url=https://github.com/ruby/ruby.git
ruby_1.0_url=ftp://ftp.ruby-lang.org/pub/ruby/1.0
ruby_1.2_url=ftp://ftp.ruby-lang.org/pub/ruby/1.2
ruby_1.3_url=ftp://ftp.ruby-lang.org/pub/ruby/1.3
ruby_1.4_url=ftp://ftp.ruby-lang.org/pub/ruby/1.4
ruby_1.5_url=ftp://ftp.ruby-lang.org/pub/ruby/1.5
ruby_1.6_url=ftp://ftp.ruby-lang.org/pub/ruby/1.6
ruby_1.7_url=ftp://ftp.ruby-lang.org/pub/ruby/1.7
ruby_1.8_url=ftp://ftp.ruby-lang.org/pub/ruby/1.8
ruby_1.9_url=ftp://ftp.ruby-lang.org/pub/ruby/1.9
ruby_2.0_url=ftp://ftp.ruby-lang.org/pub/ruby/2.0
ruby_1.9.1_patch_level=431
ruby_1.9.2_patch_level=180
ruby_1.8.5_patch_level=231
ruby_1.8.6_patch_level=420
ruby_1.8.7_patch_level=334
rubygems_1.3.5_url=http://rubyforge.org/frs/download.php/60718
rubygems_1.3.6_url=http://rubyforge.org/frs/download.php/69365
rubygems_1.3.7_url=http://rvm.beginrescueend.com/src
rubygems_1.4.1_url=http://rubyforge.org/frs/download.php/73779
rubygems_1.4.2_url=http://rubyforge.org/frs/download.php/73882
rubygems_1.5.0_url=http://rubyforge.org/frs/download.php/74140
rubygems_1.5.1_url=http://rubyforge.org/frs/download.php/74220
rubygems_1.5.2_url=http://rubyforge.org/frs/download.php/74234
rubygems_1.5.3_url=http://rubyforge.org/frs/download.php/74343
rubygems_1.6.0_url=http://rubyforge.org/frs/download.php/74374
rubygems_repo_url=git://github.com/rubygems/rubygems.git
rubygems_version=1.6.0
rbx_version=head
rbx_1.0.0_patch_level=20100514
rbx_1.0.1_patch_level=20100603
rbx_1.1.0_patch_level=20100923
rbx_1.1.1_patch_level=20101116
rbx_1.2.0_patch_level=20101221
rbx_1.2.1_patch_level=20110215
rbx_1.2.2_patch_level=20110222
rbx_url=http://asset.rubini.us
rubinius_repo_url=git://github.com/evanphx/rubinius.git
ree_version=1.8.7
ree_configure_flags=--dont-install-useful-gems
ree_1.8.6_patch_level=20090610
ree_1.8.6_url=http://rubyforge.org/frs/download.php/58677
ree_1.8.6_repo_url=git://github.com/FooBarWidget/rubyenterpriseedition.git
ree_1.8.7_url=http://rvm.beginrescueend.com/src
ree_1.8.7_repo_url=git://github.com/FooBarWidget/rubyenterpriseedition187-330
ree_1.8.7_patch_level=2011.03
jruby_version=1.5.6
jruby_repo_url=git://github.com/jruby/jruby.git
jruby_url=http://jruby.org.s3.amazonaws.com/downloads
macruby_version=0.9
macruby_nightly_version=0.10
macruby_url=http://www.macruby.org/files
macruby_repo_url=git://git.macruby.org/macruby/MacRuby.git
macruby_nightly_url=http://www.macruby.org/files/nightlies/macruby_nightly-latest.pkg
maglev_version=25329
maglev_url=http://glass-downloads.gemstone.com/maglev
maglev_repo_url=git://github.com/MagLev/maglev.git
ironruby_version=1.0
ironruby_repo_url=git://github.com/ironruby/ironruby.git
ironruby_1.0_url=http://rubyforge.org/frs/download.php/70179
# Packages
readline_url=ftp://ftp.gnu.org/gnu/readline
libiconv_url=http://ftp.gnu.org/pub/gnu/libiconv
curl_url=http://curl.haxx.se/download
openssl_url=http://www.openssl.org/source
zlib_url=http://www.zlib.net
autoconf_url=ftp.gnu.org/gnu/autoconf
ncurses_url=http://ftp.gnu.org/pub/gnu/ncurses
pkg-config_url=http://pkgconfig.freedesktop.org/releases
gettext_url=ftp://ftp.gnu.org/pub/gnu/gettext
libxml2_url=ftp://xmlsoft.org/libxml2
yaml_url=http://pyyaml.org/download/libyaml
glib_url=http://ftp.gnome.org/pub/gnome/sources/glib/2.23
mono_url=http://ftp.novell.com/pub/mono/sources/mono
llvm_url=https://llvm.org/svn/llvm-project/llvm/trunk

gem sources:
http://rubygems.org/

1 个答案:

答案 0 :(得分:0)

问题是rubygems仍安装在.rvm目录中。所以我尝试删除rubygems,但我仍然将gem安装放在.rvm目录中,即使在我的bash文件中删除了对.rvm的所有引用之后。

但是我发现当我告诉.rvm使用系统ruby时,事实证明我/ usr / bin中的系统ruby仍然有对.rvm的引用。所以我破坏了rvm,并从源代码构建了ruby,现在一切正常。