ruby-on-rails – rvm gem安装错误?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – rvm gem安装错误?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在乱搞 rubygems和rvm并且它工作得非常好但是现在当我尝试安装gem时我得到一个错误

gem install railsERROR: While
executing gem … (Errno::EACCES)
Permission denied – /Users/da/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/.gitignore

它在我做sudo时有效,但在安装gem之前我从未必须这样做.

$gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
  - INSTALLATION DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/da/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/da/.rvm/gems/ruby-1.9.2-p180
     - /Users/da/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/
$sudo gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
  - INSTALLATION DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/danest/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/da/.rvm/gems/ruby-1.9.2-p180
     - /Users/da/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

解决方法

看起来您已将root用户设置为使用主文件夹中的rvm install.这意味着当您使用sudo安装gem时,这些文件将属于root.因此,当您尝试像您一样安装gem时,您将收到权限错误.

要修复,你需要将rvm文件夹重新给你(我假设,从你的文件路径,你的用户名是’da’在这里)…

sudo chown -R da:da /Users/da/.rvm

为了避免将来发生这种情况,我建议将root的路径设置为自己安装的rvm或系统gem.

猜你在找的Ruby相关文章