宝石安装权限问题 [英] gem install permission problem

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

问题描述

  qichunren @ zhaobak:〜> gem install hpricot 
错误:执行gem时(Gem :: FilePermissionError)
您没有写入/opt/ruby-enterprise-1.8.7/lib/ruby/gems权限/1.8目录。

当前登录用户是qichunren,而qichunre用户有.gem dir的写入权限。我想知道为什么gem不是首先将文件安装到我的家.gem目录中?为什么我的宝石通用首先要将文件安装到/opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8中

解决方案

对于全系统的Ruby安装,请成为root用户。例如:

  $ sudo gem install hpricot 

然而,在许多情况下(包括开发中),现代方法是使用一种工具,让您可以轻松安装和使用Ruby作为普通用户。这可以让你避免成为root用户。有一些这样的工具,我使用的工具是 RVM

 #将rvm安装到您的〜
$ \curl -sSL https://get.rvm.io | bash -s stable

#将最新版本的ruby安装到你的〜
$ rvm install ruby​​

#在你的〜
$ gem中安装一个gem安装$ SOME_GEM_NAME


qichunren@zhaobak:~> gem install hpricot
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8 directory.

Current login user is qichunren, and qichunre user have write permission with .gem dir.I would like to know why gem not install files into my home .gem dir first? Why my gem common first want to install files into /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8

解决方案

For a systemwide Ruby install, become root. For example:

$ sudo gem install hpricot

However, the modern approach in many circumstances, including in development, is to use a tool that lets you easily install and use Ruby as a normal user. This lets you avoid having to become root. There are a few such tools, and the one I use is RVM.

# install rvm into your ~
$ \curl -sSL https://get.rvm.io | bash -s stable

# install latest version of ruby into your ~
$ rvm install ruby

# installs a gem into your ~
$ gem install $SOME_GEM_NAME

这篇关于宝石安装权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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