本文介绍了由于权限被拒绝,“捆绑安装"失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在新服务器上安装了bundler gem,当我尝试执行bundle install时,它失败并显示以下错误:

I've installed bundler gem on my new server and when I try to execute bundle install, it failed with this error :

Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/usr/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Permission denied - /var/lib/gems (Errno::EACCES)

我的服务器是Debian wheezy(7.1),默认安装了ruby 1.9.3软件包.我已经像这样配置/etc/gemrc:gem: --user-install允许用户在本地安装gems.

My server is a Debian wheezy (7.1) with default ruby 1.9.3 package installed. I have configured /etc/gemrc like this : gem: --user-install to allow users install gems locally.

bundler gem已安装到我用户的gems目录~/.gem中,就像我想要的那样:gem install bundler(无sudo).但是捆绑软件想将gems安装到/var/lib/gems而不是我的gems目录:(

The bundler gem was installed inside my user's gems dir ~/.gem like i want with this command : gem install bundler (no sudo). But bundler want install gems into /var/lib/gems instead my gems directory :(

我不明白捆绑程序有什么问题...为什么它不尝试在我想要的位置(在我的gems本地目录中)安装gem?

I don't understand what's wrong with bundler... Why it doesn't try to install gem where I want (in my gems local dir) ?

ps:在我的笔记本电脑中,安装了archlinux和默认的ruby 2.0.0软件包后,捆绑程序就可以安装用户的gems了.

ps: in my laptop, with archlinux and default ruby 2.0.0 package installed, I have no problems with bundler to install user's gems.

推荐答案

我发现了!

我已经像这样gem update --system更新了我的红宝石.但是由于/etc/.gemrc中的gem: --user-install限制,仅更新了我的本地gem.捆扎机工作时,它使用的是全球红宝石而不是我的.

I had updated my rubygem like this gem update --system. But only my local gems were update due to the gem: --user-install restriction in my /etc/.gemrc. When bundler works, it use the global rubygem and not mine.

要解决此问题,我将全局rubygems更新为:sudo gem update --system --no-user-install.

To fixe this issue, I updated the global rubygems with : sudo gem update --system --no-user-install.

一切正常!

这篇关于由于权限被拒绝,“捆绑安装"失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 15:15