ruby-on-rails – 主要的未定义方法`require_relative’:Object(NoMethodError)

在尝试更新OpenSSL时 – 我在笔记本电脑上打破了(似乎)Ruby和Rails的所有内容.即使卸载ruby和rails通过gem uninstall和rvm removeI仍然遇到此错误:

Drews-MacBook-Pro:bookstore drewwyatt$rails server
bin/rails:3: undefined method `require_relative' for main:Object (NoMethodError)

几个月来一切都运转正常,直到我四处乱窜 – 更糟糕的是,我甚至不确定我做了什么来搞砸了.

额外信息

Drews-MacBook-Pro:bookstore drewwyatt$ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
Drews-MacBook-Pro:bookstore drewwyatt$which ruby
/Users/drewwyatt/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
Drews-MacBook-Pro:bookstore drewwyatt$rails -v
bin/rails:3: undefined method `require_relative' for main:Object (NoMethodError)
Drews-MacBook-Pro:bookstore drewwyatt$which rails
/Users/drewwyatt/.rvm/rubies/ruby-2.0.0-p247/bin/rails
Drews-MacBook-Pro:bookstore drewwyatt$

更新 – 没有sudo安装

Drews-MacBook-Pro:~ drewwyatt$gem install rails
Fetching: railties-4.0.0.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /Users/drewwyatt/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks
Drews-MacBook-Pro:~ drewwyatt$
我通过完全删除Rails,Ruby和RVM来解决问题 – 然后从头开始.

我不完全记得所有的命令,但它是这样的:

sudo gem uninstall rails
sudo rvm remove 2.0
rvm implode
sudo chown -R drewwyatt: ~/.rvm/
rm -rf ~/.rvm
\curl -L https://get.rvm.io | bash -s stable --rails
rvm use 2.0
gem install rails

转载注明原文:ruby-on-rails – 主要的未定义方法`require_relative’:Object(NoMethodError) - 代码日志