我使用sudo
来安装gem并更新rubygems本身,但这会导致/usr/lib/ruby/gems/1.8/gems
中所有新文件的问题由root:root
拥有750
的权限
这反过来导致大多数宝石无法加载。
例如,我最近更新了rubygems,如果我尝试gem env
,我会得到:
/usr/local/lib/site_ruby/1.8/rubygems/specification.rb:512:in `read': Permission denied - /usr/lib/ruby/gems/1.8/specifications/rubygems-update-1.6.2.gemspec (Errno::EACCES) from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:512:in `load' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:116:in `load_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:115:in `each' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:115:in `load_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:112:in `reverse_each' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:112:in `load_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:309:in `refresh!' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:67:in `from_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:47:in `from_installed_gems' from /usr/local/lib/site_ruby/1.8/rubygems.rb:1025:in `source_index' from /usr/local/lib/site_ruby/1.8/rubygems/gem_path_searcher.rb:135:in `init_gemspecs' from /usr/local/lib/site_ruby/1.8/rubygems/gem_path_searcher.rb:14:in `initialize' from /usr/local/lib/site_ruby/1.8/rubygems.rb:984:in `new' from /usr/local/lib/site_ruby/1.8/rubygems.rb:984:in `searcher' from /usr/local/lib/site_ruby/1.8/rubygems.rb:206:in `try_activate' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:57:in `require' from /usr/local/lib/site_ruby/1.8/rubygems/config_file.rb:55 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from /usr/local/lib/site_ruby/1.8/rubygems/gem_runner.rb:8 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from /usr/bin/gem:9
目前的解决方法是chmod
所有人都可以读取所有文件,但这真的很烦人。
一些服务器统计信息:
uname -a
给出了
Linux HomeBox 2.6.35 28-server #49-Ubuntu SMP Tue Mar 1 14:55:37 UTC 2011 x86_64 GNU/Linux
sudo gem env
给出了
RubyGems Environment: - RUBYGEMS VERSION: 1.6.2 - RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux] - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /usr/lib/ruby/gems/1.8 - /home/nicklas/.gem/ruby/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/
ruby -v
给出了
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
我很乐意提供有关此问题的更多信息。
我刚清理掉所有红宝石和rubygems的东西并重新安装它。同样的问题。
答案 0 :(得分:1)