我开始尝试设置本地 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?
编辑:更新!
在我看来,我安装了两次 gem,一次在 /var/lib/gems/1.9.91(坏),一次在 /home/myusername/.gem/ruby/1.9.1(好)。
我认为这里发生的事情是,当我键入“gem”时,/var/lib/gems/1.9.1(坏)中的安装优先于 /home/myusername/.gem/ruby/1.9.1(好) . 谁能证实这一点?此外,是否可以只删除坏目录来修复问题,还是会导致问题?