RVM gem权限错误 [英] RVM gem permissions error

查看:67
本文介绍了RVM gem权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始尝试为开发设置本地Rails安装.但是,在使用apt-get安装后,我了解了RVM,因此我删除了较早的版本,然后从RVM重新安装.不过,看来我还有其他问题.具体来说,当我尝试安装滑轨时,我得到...

$ gem install rails
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /var/lib/gems/1.9.1 directory.

这似乎已经是一个问题,因为我不希望它在/var/目录中,而我希望它在用户目录中.所以,我检查以下内容...

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.11
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /home/myusername/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

以及sudo'd

$ sudo gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.11
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /home/myusername/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

出于某些原因,宝石似乎位于/var/lib中.这正常吗?如何解决此问题,以便安装Rails gem?

更新!

在我看来,我已经安装了两次gems,一次是在/var/lib/gems/1.9.91(错误)中,一次是在/home/myusername/.gem/ruby/1.9.1(良好)中. /p>

我认为这里发生的是,当我键入"gem"时,/var/lib/gems/1.9.1(错误)中的安装优先于/home/myusername/.gem/ruby/1.9.1. (好的).有人可以确认吗?另外,仅删除错误的目录就可以解决问题,还是会造成问题?

解决方案

您错过了使用ruby的方法,可以这样做:

rvm use 1.9.3 --install

如果未安装1.9.3,此命令也将安装它!

看起来您正在使用Ubuntu,请确保您没有使用Ubuntu软件包中的RVM-这东西坏了!您可以在此处找到如何修复它的说明: https://stackoverflow.com/a/9056395/497756

I started trying to set up a local rails installation for development. After I installed in using apt-get, however, I learned about RVM, so I removed the earlier one, and reinstalled from RVM. It looks like I have residual problems, though. Specifically, when I try to install rails I get...

$ gem install rails
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /var/lib/gems/1.9.1 directory.

This already looks like a problem, because I don't want it to be in the /var/ directory, I want it to be in the user directory. So, I check the following...

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.11
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /home/myusername/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

As well as sudo'd:

$ sudo gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.11
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /home/myusername/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

gems seem to live in /var/lib for some reason. Is this normal? How can I fix this so I can install the rails gem?

EDIT: UPDATE!

It appears to me that I have gems installed twice, once in /var/lib/gems/1.9.91 (bad) and once in /home/myusername/.gem/ruby/1.9.1 (good).

I think what is happening here is that when I type "gem" the installation in /var/lib/gems/1.9.1 (bad) is taking priority over /home/myusername/.gem/ruby/1.9.1 (good). Can anyone confirm that? Also, would it be OK and fix things just to delete the bad directory, or would that cause problems?

解决方案

You missed to use ruby, you can do it with:

rvm use 1.9.3 --install

In case 1.9.3 was not installed, this command will also install it!

It also looks you are using Ubuntu, make sure you are not using RVM from Ubuntu package - that thing is broken! You can find instruction how to fix it here: https://stackoverflow.com/a/9056395/497756

这篇关于RVM gem权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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