2012-03-24 139 views
5

當我想執行的Rails 3遊戲機,它拋出這樣的:沒有這樣的文件來加載 - 的ReadLine(加載錯誤)

$ script/rails c 
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (Load Error) 

我試圖安裝libreadline-dev

$ sudo wajig install libreadline-dev 
Leyendo lista de paquetes... Hecho 
Creando árbol de dependencias  
Leyendo la información de estado... Hecho 
Se instalarán los siguientes paquetes extras: 
    libncurses5-dev libreadline6-dev 
Se instalarán los siguientes paquetes NUEVOS: 
    libncurses5-dev libreadline-dev libreadline6-dev 
0 actualizados, 3 se instalarán, 0 para eliminar y 6 no actualizados. 
Necesito descargar 1799kB de archivos. 
Se utilizarán 7266kB de espacio de disco adicional después de esta operación. 
¿Desea continuar [S/n]? 
Des:1 http://mx.archive.ubuntu.com/ubuntu/ lucid/main libncurses5-dev 5.7+20090803-2ubuntu3 [1564kB] 
Des:2 http://mx.archive.ubuntu.com/ubuntu/ lucid/main libreadline6-dev 6.1-1 [234kB] 
Des:3 http://mx.archive.ubuntu.com/ubuntu/ lucid/main libreadline-dev 6.1-1 [904B] 
Descargados 1799kB en 3seg. (477kB/s) 
Seleccionando el paquete libncurses5-dev previamente no seleccionado. 
(Leyendo la base de datos ... 00% 
225006 ficheros y directorios instalados actualmente.) 
Desempaquetando libncurses5-dev (de .../libncurses5-dev_5.7+20090803-2ubuntu3_i386.deb) ... 
Seleccionando el paquete libreadline6-dev previamente no seleccionado. 
Desempaquetando libreadline6-dev (de .../libreadline6-dev_6.1-1_i386.deb) ... 
Seleccionando el paquete libreadline-dev previamente no seleccionado. 
Desempaquetando libreadline-dev (de .../libreadline-dev_6.1-1_i386.deb) ... 
Procesando disparadores para man-db ... 
Procesando disparadores para install-info ... 
Configurando libncurses5-dev (5.7+20090803-2ubuntu3) ... 
Configurando libreadline6-dev (6.1-1) ... 
Configurando libreadline-dev (6.1-1) ... 

但是,當我再次嘗試,它拋出塔一樣了:

$ script/rails c 
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError) 
    from /usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `require' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `<top (required)>' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `require' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

然後,我嘗試使用安裝:

# rvm pkg install readline 
Fetching readline-5.2.tar.gz to /usr/local/rvm/archives 
Extracting readline-5.2.tar.gz to /usr/local/rvm/src 
Applying patch '/usr/local/rvm/patches/readline-5.2/shobj-conf.patch'... 
Configuring readline in /usr/local/rvm/src/readline-5.2. 
Compiling readline in /usr/local/rvm/src/readline-5.2. 
Installing readline to /usr/local/rvm/usr 
Fetching readline-6.2.tar.gz to /usr/local/rvm/archives 
Extracting readline-6.2.tar.gz to /usr/local/rvm/src 
Applying patch '/usr/local/rvm/patches/readline-6.2/patch-shobj-conf.diff'... 
Configuring readline in /usr/local/rvm/src/readline-6.2. 
Compiling readline in /usr/local/rvm/src/readline-6.2. 
Installing readline to /usr/local/rvm/usr 

但同樣是相同的:

$ script/rails c 
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError) 
    from /usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `require' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands/console.rb:3:in `<top (required)>' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `require' 
    from /usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.0.4/lib/rails/commands.rb:20:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

還有什麼我應該嘗試一下呢?

+0

請注意,你不必跑'wajig'使用sudo,因爲它自動會爲你需要的時候。也就是說,只需運行'wajig install ...'。 – Tshepang 2012-12-21 09:20:51

回答

6

我必須檢查rvm requirements並確保已安裝所有軟件包。 然後reintall紅寶石:

rvm reinstall 1.9.2 
Removing /usr/local/rvm/src/ruby-1.9.2-p318... 
Removing /usr/local/rvm/rubies/ruby-1.9.2-p318... 
Removing default ruby interpreter 
Removing ruby-1.9.2-p318 aliases... 
Removing ruby-1.9.2-p318 wrappers... 
Removing ruby-1.9.2-p318 environments... 
Removing ruby-1.9.2-p318 binaries... 
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.2-p318, this may take a while depending on your cpu(s)... 
ruby-1.9.2-p318 - #fetching 
ruby-1.9.2-p318 - #extracting ruby-1.9.2-p318 to /usr/local/rvm/src/ruby-1.9.2-p318 
ruby-1.9.2-p318 - #extracted to /usr/local/rvm/src/ruby-1.9.2-p318 
ruby-1.9.2-p318 - #configuring 
ruby-1.9.2-p318 - #compiling 
ruby-1.9.2-p318 - #installing 
Removing old Rubygems files... 
Installing rubygems-1.8.18 for ruby-1.9.2-p318 ... 
Installation of rubygems completed successfully. 
ruby-1.9.2-p318 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). 
ruby-1.9.2-p318 - #importing default gemsets (/usr/local/rvm/gemsets/) 
Install of ruby-1.9.2-p318 - #complete 

最後它的工作原理:

$ script/rails c 
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <top (required)> at /home/israel/proyectos/d-Formacion/config/application.rb:7) 
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/actionpack-3.0.4/lib/action_dispatch/http/mime_type.rb:98: warning: already initialized constant PDF 
Loading development environment (Rails 3.0.4) 
1.9.2-p318 :001 > exit 
5

將溶液組合兩個步驟:

  1. 安裝libreadline-dev的例如在Ubuntu的做:

    sudo apt-get install libreadline-dev 
    
  2. 重新安裝紅寶石

    rvm install 1.9.2 
    

然後紅寶石將會使用libreadline進行編譯。

6

重新安裝紅寶石是一種矯枉過正,你可以按照這篇博文的指示。

http://vvv.tobiassjosten.net/ruby-on-rails/fixing-readline-for-the-ruby-on-rails-console

的libreadline5安裝的libncurses5和

$ sudo aptitude install libreadline5-dev libncurses5-dev 

然後重新編譯和安裝紅線

cd ~/.rvm/src/ruby-1.9.2-p180/ext/readline 
ruby extconf.rb 
make 
make install 
+0

這工作就像一個魅力。無需重新安裝Ruby!謝謝 :) – Josh 2013-09-04 23:52:58

相關問題