main:Object的未定义方法`require_relative'(NoMethodError) [英] undefined method `require_relative' for main:Object (NoMethodError)

查看:132
本文介绍了main:Object的未定义方法`require_relative'(NoMethodError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试更新OpenSSL时-我(似乎)破坏了笔记本电脑上围绕Ruby和Rails的所有内容.即使通过gem uninstallrvm remove卸载ruby和rails之后,我仍然遇到此错误:

When trying to update OpenSSL - I broke (seemingly) everything surrounding Ruby and Rails on my laptop. Even after uninstalling ruby and rails through gem uninstall and rvm removeI am still running into this error:

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

一切都好几个月了,直到我四处游荡-更糟糕的是,我什至不确定自己是怎么把事情搞砸的.

Everything has been working fine for months until I went mucking around - the worse part is that I'm not even sure what I did to mess things up.

更多信息

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(然后从头开始)来解决此问题.

我不记得所有的命令了,但是有点像:

I don't remember all of the commands exactly, but it was something like:

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

这篇关于main:Object的未定义方法`require_relative'(NoMethodError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆