ruby​​gems报错“no such file to load”怎么办?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (26)

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

根据我的知识,我已经安装了所有基本知识来启动并运行基本脚本/服务器。当我尝试脚本/服务器时,我从boot.rb弹出了这个错误。我想在这里提供一些细节:

[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 -- rubygems (LoadError)
 from ./script/../config/boot.rb:9
 from script/server:2:in `require'
 from script/server:2

PATH文件看起来像这样

[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"

我想这与PATH文件有关。

提问于
用户回答回答于
用户回答回答于

我在Ubuntu上也有类似的问题,因为我安装了多个ruby。(1.8和1.9.1)不幸的是,我需要两者。解决办法是使用:

$ sudo update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/ruby1.8     50        auto mode
  1            /usr/bin/ruby1.8     50        manual mode
  2            /usr/bin/ruby1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.

扫码关注云+社区