在Ubuntu 11.04上安装Ruby on Rails失败:找不到文件'lib'

时间:2011-08-03 04:52:15

标签: ruby-on-rails ruby ruby-on-rails-3

我跟着this instruction在我的ubuntu 11.04上安装Ruby on Rails,但总是收到此错误消息:

feicun@feicun-ubuntu:~$ gem install rails
Successfully installed rails-3.0.9
1 gem installed
Installing ri documentation for rails-3.0.9...
file 'lib' not found
Installing RDoc documentation for rails-3.0.9...
file 'lib' not found

我搜索了这个问题,这意味着无法构建文档,但安装了rails 3.0.9。为了解决这个问题,我尝试了两种方法:

  1. 在rails'文件夹

    中创建一个“lib”文件夹

    sudo mkdir /home/feicun/.rvm/gems/ruby-1.9.2-p290/gems/rails-3.0.9/lib

  2. 在安装rails之前运行“gem install rdoc

  3. 但是这两种方法对我来说都不起作用,这些方法在rails-3.0.9文件夹中仍然没有lib文件夹。

    这是我的环境:

    feicun@feicun-ubuntu:~$ which ruby
    /home/feicun/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
    feicun@feicun-ubuntu:~$ which gem
    /home/feicun/.rvm/rubies/ruby-1.9.2-p290/bin/gem
    feicun@feicun-ubuntu:~$ which rails
    /home/feicun/.rvm/gems/ruby-1.9.2-p290/bin/rails
    feicun@feicun-ubuntu:~$ gem environment
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.8.6
      - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [i686-linux]
      - INSTALLATION DIRECTORY: /home/feicun/.rvm/gems/ruby-1.9.2-p290
      - RUBY EXECUTABLE: /home/feicun/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
      - EXECUTABLE DIRECTORY: /home/feicun/.rvm/gems/ruby-1.9.2-p290/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86-linux
      - GEM PATHS:
         - /home/feicun/.rvm/gems/ruby-1.9.2-p290
         - /home/feicun/.rvm/gems/ruby-1.9.2-p290@global
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - http://rubygems.org/
    

3 个答案:

答案 0 :(得分:1)

我按照这些说明here on stackoverflow

gem install rdoc

然后再次尝试安装rails

gem install rails

这解决了我的问题。

答案 1 :(得分:0)

  

sudo mkdir /home/feicun/.rvm/gems/ruby-1.9.2-p290/gems/rails-3.0.9/lib

为什么使用sudo在rvm文件夹中创建目录?我想权限存在一些问题。删除lib文件夹并运行:

  

mkdir /home/feicun/.rvm/gems/ruby-1.9.2-p290/gems/rails-3.0.9/lib

答案 2 :(得分:0)

我遇到了同样的问题,我所做的只是恢复到之前版本的RubyGems而且一切正常; (我没有深入研究为什么会出现这种情况,但在我确定插入之后它就成了我最初的故障排除解决方案;)