web-dev-qa-db-ja.com

「Rubyのインストールに(YAML出力の場合)精神が欠けている」の修正方法CentOSでは?

CentOS 5.8にrvmをインストールした後:

[Rails@localhost ~]$ rvm -v
rvm 1.16.17
[Rails@localhost ~]$ which Ruby
~/.rvm/rubies/Ruby-1.9.3-p286/bin/Ruby
[Rails@localhost ~]$ Ruby -v
Ruby 1.9.3p286 (2012-10-12 revision 37165) [i686-linux]
[Rails@localhost ~]$ which gem
~/.rvm/rubies/Ruby-1.9.3-p286/bin/gem

警告があります:

$ gem -v
/home/Rails/.rvm/rubies/Ruby-1.9.3-p286/lib/Ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your Ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your Ruby.
1.8.24

私は従った いくつかのアドバイス

$ rvm pkg install libyaml
Fetching yaml-0.1.4.tar.gz to /home/Rails/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /home/Rails/.rvm/src
Prepare yaml in /home/Rails/.rvm/src/yaml-0.1.4.
Configuring yaml in /home/Rails/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/Rails/.rvm/src/yaml-0.1.4.
Installing yaml to /home/Rails/.rvm/usr

Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

その後:

$ rvm reinstall all --force
Removing /home/Rails/.rvm/src/Ruby-1.8.7-p371...
Removing /home/Rails/.rvm/rubies/Ruby-1.8.7-p371...
No binary rubies available for: centos/5.8/i386/Ruby-1.8.7-p371.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing Ruby from source to: /home/Rails/.rvm/rubies/Ruby-1.8.7-p371, this may take a while depending on your cpu(s)...
Ruby-1.8.7-p371 - #downloading Ruby-1.8.7-p371, this may take a while depending on your connection...
Ruby-1.8.7-p371 - #extracting Ruby-1.8.7-p371 to /home/Rails/.rvm/src/Ruby-1.8.7-p371
Ruby-1.8.7-p371 - #extracted to /home/Rails/.rvm/src/Ruby-1.8.7-p371
Applying patch /home/Rails/.rvm/patches/Ruby/1.8.7/stdout-rouge-fix.patch
Applying patch /home/Rails/.rvm/patches/Ruby/1.8.7/no_sslv2.diff
Ruby-1.8.7-p371 - #configuring
Ruby-1.8.7-p371 - #compiling
Ruby-1.8.7-p371 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.24 for Ruby-1.8.7-p371 ...
Installation of rubygems completed successfully.
Saving wrappers to '/home/Rails/.rvm/bin'.
Ruby-1.8.7-p371 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Ruby-1.8.7-p371 - #importing default gemsets (/home/Rails/.rvm/gemsets/)
Install of Ruby-1.8.7-p371 - #complete 
Please be aware that you just installed a Ruby that requires 2 patches just to be compiled on up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to Ruby 1.9.3-286 which will have all of the latest security patches.
Making gemset Ruby-1.8.7-p371 pristine.
Making gemset Ruby-1.8.7-p371@global pristine.
Removing /home/Rails/.rvm/src/Ruby-1.9.3-p286...
Removing /home/Rails/.rvm/rubies/Ruby-1.9.3-p286...
No binary rubies available for: centos/5.8/i386/Ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing Ruby from source to: /home/Rails/.rvm/rubies/Ruby-1.9.3-p286, this may take a while depending on your cpu(s)...
Ruby-1.9.3-p286 - #downloading Ruby-1.9.3-p286, this may take a while depending on your connection...
Ruby-1.9.3-p286 - #extracting Ruby-1.9.3-p286 to /home/Rails/.rvm/src/Ruby-1.9.3-p286
Ruby-1.9.3-p286 - #extracted to /home/Rails/.rvm/src/Ruby-1.9.3-p286
Ruby-1.9.3-p286 - #configuring
Ruby-1.9.3-p286 - #compiling
Ruby-1.9.3-p286 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.24 for Ruby-1.9.3-p286 ...
Installation of rubygems completed successfully.
Saving wrappers to '/home/Rails/.rvm/bin'.
Ruby-1.9.3-p286 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Ruby-1.9.3-p286 - #importing default gemsets (/home/Rails/.rvm/gemsets/)
Install of Ruby-1.9.3-p286 - #complete 
Making gemset Ruby-1.9.3-p286 pristine.
Making gemset Ruby-1.9.3-p286@global pristine.

残念ながら、警告はまだ残っています:

$ gem -v
/home/Rails/.rvm/rubies/Ruby-1.9.3-p286/lib/Ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your Ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your Ruby.
1.8.24

警告を取り除くにはどうすればよいですか?

更新:(rvm reinstall 1.9.3 --movable

$ rvm reinstall 1.9.3 --movable
Removing /home/Rails/.rvm/src/Ruby-1.9.3-p286...
Removing /home/Rails/.rvm/rubies/Ruby-1.9.3-p286...
Fetching yaml-0.1.4.tar.gz to /home/Rails/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /home/Rails/.rvm/src
Prepare yaml in /home/Rails/.rvm/src/yaml-0.1.4.
Configuring yaml in /home/Rails/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/Rails/.rvm/src/yaml-0.1.4.
Installing yaml to /home/Rails/.rvm/rubies/Ruby-1.9.3-p286
Installing Ruby from source to: /home/Rails/.rvm/rubies/Ruby-1.9.3-p286, this may take a while depending on your cpu(s)...
Ruby-1.9.3-p286 - #downloading Ruby-1.9.3-p286, this may take a while depending on your connection...
Ruby-1.9.3-p286 - #extracting Ruby-1.9.3-p286 to /home/Rails/.rvm/src/Ruby-1.9.3-p286
Ruby-1.9.3-p286 - #extracted to /home/Rails/.rvm/src/Ruby-1.9.3-p286
Applying patch /home/Rails/.rvm/patches/Ruby/1.9.3/Ruby-multilib.patch
Error running 'patch -F 25 -p1 -N -f -i /home/Rails/.rvm/patches/Ruby/1.9.3/Ruby-multilib.patch', please read /home/Rails/.rvm/log/Ruby-1.9.3-p286/patch.apply.Ruby-multilib.log
There has been an error applying the specified patches. Halting the installation.
Making gemset Ruby-1.9.3-p286 pristine.
Making gemset Ruby-1.9.3-p286@global pristine.
5
ohho

rvm pkg install libyamlの後に、Ruby 1.9.3を再インストールします。

 rvm reinstall 1.9.3 --with-libyaml-dir=/home/Rails/.rvm/usr

クレジット:https://stackoverflow.com/a/12882906/88597

13
ohho

これを試して:

rvm get head
rvm reinstall 1.9.3 --movable
1
mpapis
Sudo apt-get install libtool
Sudo apt-get install libyaml-dev
rvm reinstall 1.9.3

私はすべてを試しました、これは私の問題を解決しました。

1
Gatix

Libyamlをインストールする必要があると思います。

$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz 
$ tar xzvf yaml-0.1.4.tar.gz 
$ cd yaml-0.1.4 
$ ./configure --prefix=/usr/local 
$ make 
$ make install

参照: http://collectiveidea.com/blog/archives/2011/10/31/install-Ruby-193-with-libyaml-on-centos/

代替リポジトリからlibyaml-develをインストールできます(私はrepoforge.orgを使用しました):

Sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Sudo rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Sudo yum install -y libyaml-devel
0
taro