没有这样的文件加载 - ruby​​gems(LoadError) [英] no such file to load -- rubygems (LoadError)

查看:272
本文介绍了没有这样的文件加载 - ruby​​gems(LoadError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在fedora 12中安装了rails。我也是linux新手。一切工作正常在Windows 7上。但我在Linux中面临很多问题。请帮助!



为了让基本脚本/服务器正常运行,我安装了所有基本知识。当我尝试脚本/服务器时,我从boot.rb弹出这个错误。我想在这里给出的一些细节:

安装rails,ruby和gem的目录

  [vineeth @ localhost my_app] $ which ruby​​ 
/ usr / local / bin / ruby​​

[vineeth @ localhost my_app] $ which rails
/ usr / bin / rails

[vineeth @ localhost my_app] $ which gem
/ usr / bin / gem

并且当我运行脚本/服务器时,这是错误。

  [vineeth @ localhost my_app] $ script / server 
./script/../config/boot.rb:9:in`require':no such file to load - ruby​​gems(LoadError)$ b / b from ./script/../config/boot.rb:9
from script / server:2:in'require'
from脚本/服务器:2

PATH文件看起来像这样

  [vineeth @ localhost my_app] $ cat〜/ .bash_profile 
#.bash_profile

#获取别名和函数
if [-f〜/ .bashrc];然后
。 〜/ .bashrc
fi

#用户特定的环境和启动程序

PATH = $ PATH:$ HOME / bin

导出PATH =/ usr / local / bin:/ usr / local / sbin:/ usr / bin / ruby​​:$ PATH

我想这与PATH文件有关。让我知道我需要在这里改变。如果还有其他更改,请告诉我。

解决方案

我有一个预感,您有两个ruby版本。请粘贴以下命令的输出:

  $ which -a ruby​​ 

更新了关于评论的内容:

一。我有两个版本在寻找宝石的不同位置时遇到同样的问题。让我疯了好几个星期。在这里付出赏金,让我得到同样的答案,我给你。

我所做的只是一次安装红宝石,并通过端口留下一个可管理的宝石。我建议这样做:


  1. 删除通过端口安装的ruby版本(yum或任何包管理器)。
  2. 删除操作系统附带的ruby版本(手动使用硬核rm)。
  3. 从具有不同前缀的端口安装ruby版本( / usr c> / usr / local )

  4. 重新安装 ruby​​gems


I recently installed rails in fedora 12. I'm new to linux as well. Everything works fine on Windows 7. But I'm facing lot of problems in linux. Help please!

I've installed all the essentials to my knowledge to get the basic script/server up and running. I have this error from boot.rb popping up when I try script/server. Some of the details I'd like to give here:

The directories where rails, ruby and gem are installed,

[vineeth@localhost my_app]$ which ruby
/usr/local/bin/ruby

[vineeth@localhost my_app]$ which rails
/usr/bin/rails

[vineeth@localhost my_app]$ which gem
/usr/bin/gem

And when I run the script/server, this is the error.

[vineeth@localhost my_app]$ script/server
./script/../config/boot.rb:9:in `require': no such file to load -- rubygems (LoadError)
 from ./script/../config/boot.rb:9
 from script/server:2:in `require'
 from script/server:2

And the PATH file looks like this

[vineeth@localhost my_app]$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin/ruby:$PATH"

I suppose it is something to do with the PATH file. Let me know what I need to change here. If there are other changes I should make, please let me know.

解决方案

I have a hunch that you have two ruby versions. Please paste the output of following command:

$ which -a ruby

updated regarding to the comment:

Nuke one version and leave only one. I had same problem with two versions looking at different locations for gems. Had me going crazy for few weeks. Put up a bounty here at SO got me same answer I'm giving to you.

All I did was nuke one installation of ruby and left the one managable via ports. I'd suggest doing this:

  1. Remove ruby version installed via ports (yum or whatever package manager).
  2. Remove ruby version that came with OS (hardcore rm by hand).
  3. Install ruby version from ports with different prefix (/usr instead of /usr/local)
  4. Reinstall rubygems

这篇关于没有这样的文件加载 - ruby​​gems(LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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