如何修复我的Ruby / Rails本地环境

时间:2014-12-10 02:15:38

标签: ruby-on-rails ruby ruby-on-rails-4

我之前搞砸了我的导轨安装,所以我需要帮助重新安装它/修复它。这是错误。

gem install rails -v 4.1.1
Error loading RubyGems plugin "/usr/local/rvm/gems/ruby-2.1.2@global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": Permission denied @ dir_s_mkdir - /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0 (Errno::EACCES)
Error loading RubyGems plugin "/usr/local/rvm/gems/ruby-2.1.2/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": Permission denied @ dir_s_mkdir - /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0 (Errno::EACCES)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/local/rvm/gems/ruby-2.1.2 directory.
$ echo $GEM_HOME
/usr/local/rvm/gems/ruby-2.1.2
$ echo $GEM_PATH
/usr/local/rvm/gems/ruby-2.1.2:/usr/local/rvm/gems/ruby-2.1.2@global
$ echo $PATH
/usr/local/rvm/gems/ruby-2.1.2/bin:/usr/local/rvm/gems/ruby-2.1.2@global/bin:/usr/local/rvm/rubies/ruby-2.1.2/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/ImageMagick/bin:/opt/local/bin:/opt/local/sbin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin:/Users/at/bin:/Users/Digital/Desktop/android:/usr/share/ant/bin:/Users/Digital/Desktop/android/sdk/platform-tool:/Users/Digital/Desktop/android/sdk/platform-tools:/Users/Digital/Desktop/android/sdk/tools:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin:/Users/at/bin:/Users/Digital/Desktop/android:/usr/share/ant/bin:/Users/Digital/Desktop/android/sdk/platform-tool:/Users/Digital/Desktop/android/sdk/platform-tools:/Users/Digital/Desktop/android/sdk/tools
$ echo $RUBY_VERSION
ruby-2.1.2
$ rvm use 2.1.2
Using /usr/local/rvm/gems/ruby-2.1.2
Warning! Executable 'ruby' missing, something went wrong with this ruby installation!
Warning! Executable 'gem' missing, something went wrong with this ruby installation!
Warning! Executable 'irb' missing, something went wrong with this ruby installation!
Error loading RubyGems plugin "/usr/local/rvm/gems/ruby-2.1.2@global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": Permission denied @ dir_s_mkdir - /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0 (Errno::EACCES)
Error loading RubyGems plugin "/usr/local/rvm/gems/ruby-2.1.2/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": Permission denied @ dir_s_mkdir - /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0 (Errno::EACCES)

2 个答案:

答案 0 :(得分:1)

这似乎是全局安装的另一个RVM问题,不是吗?如何在您的主目录下安装?

https://rvm.io/rvm/install(参见"单用户安装位置:〜/ .rvm /")

另外,需要考虑的事项:

https://github.com/sstephenson/rbenv/wiki/Why-rbenv%3F

答案 1 :(得分:1)

好的,我通过卸载rvm

修复了它
rvm implode

这将删除rvm /目录及其中构建的所有rubies。为了删除rvm的最终痕迹,您还需要删除rvm gem:

gem uninstall rvm