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

栏目: Ruby · 发布时间: 6个月前

来源: codeday.me

本文转载自:https://codeday.me/bug/20190112/511535.html,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有。

在尝试更新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


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

关注码农网公众号

关注我们,获取更多IT资讯^_^


为你推荐:

相关软件推荐:

查看所有标签

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

Ruby on Rails 3 Tutorial

Ruby on Rails 3 Tutorial

Michael Hartl / Addison-Wesley Professional / 2010-12-16 / USD 39.99

“Ruby on Rails™ 3 Tutorial: Learn Rails by Example by Michael Hartl has become a must read for developers learning how to build Rails apps.” —Peter Cooper, Editor of Ruby Inside Using Rails ......一起来看看 《Ruby on Rails 3 Tutorial》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

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

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具