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

栏目: Ruby · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/18934716/undefined-method-require-relative-for-mainobject-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

翻译自:https://stackoverflow.com/questions/18934716/undefined-method-require-relative-for-mainobject-nomethoderror


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Programming Collective Intelligence

Programming Collective Intelligence

Toby Segaran / O'Reilly Media / 2007-8-26 / USD 39.99

Want to tap the power behind search rankings, product recommendations, social bookmarking, and online matchmaking? This fascinating book demonstrates how you can build Web 2.0 applications to mine the......一起来看看 《Programming Collective Intelligence》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具