Error loading gem paths on load path in gem_prelude

在用rvm安装ruby后运行gem,出现

Error loading gem paths on load path in gem_prelude
can’t modify frozen string
internal:gem_prelude:69:in force_encoding' <internal:gem_prelude>:69:in set_home’
internal:gem_prelude:38:in dir' <internal:gem_prelude>:76:in set_paths’
internal:gem_prelude:47:in path' <internal:gem_prelude>:286:in push_all_highest_version_gems_on_load_path’
internal:gem_prelude:355:in `

解决方法:找到 your/home/.rvm/src/ruby-your-version/gem_prelude.rb文件 编辑

def self.set_home(home)
 home = home.gsub File::ALT_SEPARATOR, File::SEPARATOR if File::ALT_SEPARATOR
- @gem_home = home.force_encoding(Encoding.find('filesystem'))
+ @gem_home = home.dup.force_encoding(Encoding.find('filesystem')
end