Ruby on rails 如何解决;ruby安装缺少psych“;错误?

Ruby on rails 如何解决;ruby安装缺少psych“;错误?,ruby-on-rails,ruby,macos,rvm,Ruby On Rails,Ruby,Macos,Rvm,我使用rvm安装ruby 1.9.3。尽管安装成功,它还是抱怨Libyml。现在,每当我想安装gem(比如rails)时,就会出现以下警告: It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby. 我使用MacOSX10.7(Lion) 重新加载.rvmrc(cd输出

我使用rvm安装ruby 1.9.3。尽管安装成功,它还是抱怨Libyml。现在,每当我想安装gem(比如rails)时,就会出现以下警告:

It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.
我使用MacOSX10.7(Lion)

重新加载.rvmrc(cd输出,cd输入)

就我而言

rvm pkg install 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
$ sudo make install
对于使用Ubuntu的用户,请确保在执行上述步骤之前安装了
libtool

sudo apt-get install libtool
对于macOS用户(使用自制软件):


我有这个问题。利比亚姆不会编译。原来我没找到libtool

yum install libtool
yum install libyaml (or rvm pkg install libyaml)
rvm reinstall 1.9.3
这解决了我的问题。

对于ubuntu和rvm

sudo apt-get install libtool
rvm pkg install libyaml
rvm reinstall 1.9.3
工作


是什么对我有效(在雪豹上)。

在雪豹上,Catharz的解决方案对我无效。然而,该解决方案确实:

brew install libyaml
rvm get head
rvm reinstall 1.9.3  --with-gcc=clang
(rvm重新安装给了我一个关于clang没有选项“-with libyaml”的警告,但不管怎样它解决了错误消息。)

我也遇到了同样的问题(Lion 10.7.4),并通过升级rvm然后重新安装ruby修复了它

1) 升级rvm

2) 然后使用rvm重新安装ruby 1.9.3(该版本先前已与早期版本的rvm一起安装)


这对我来说至少在Ubuntu 10.04上有效

$sudo apt get安装libtool


$rvm重新安装1.9.3

在我的例子中,解决方案是将
psych
gem添加到gem文件中。

如果不使用rvm,而是从头开始构建和安装ruby 1.9.3(例如,您正在使用管理ruby版本),则必须首先安装libyaml。从你那里得到它;目前,您想要的文件是。将tarball和cd打开到生成的文件夹中。然后:

./configure --prefix=/usr/local
make
sudo make install
现在您已经准备好构建ruby了。从下载ruby。将tarball和cd打开到生成的文件夹中。现在:

./configure --prefix=/wherever/you/want/it/to/go
make
make install

(或者可能是
sudomakeinstall
,具体取决于您将其放置在何处。)如果使用rbenv,如果您切换到
rbenv global 1.9.3-p194
(或任何您的版本)并且
gem--version
在没有警告的情况下工作,您就会知道它已经工作了。这在MacOSX10.6.8上对我很有效。(更新:我刚刚在Mac OS X 10.8.1上尝试了这个,它似乎在那里也运行得很好。)

这些答案对我都不起作用

$ brew doctor
$ brew link libyaml
我找到了我的答案 我在Centos 6.3虚拟机上

在安装ruby之前,必须先安装libyaml。如果你已经安装了ruby,你必须在再次编译源代码之前清除这些文件

# cd to your ruby source location
rm -rf /usr/local/lib/ruby # clean out ruby files
./configure
make && make install
gem -v # check if error is fixed
我也有同样的问题(CentOS5.7),上面的解决方案对我都不起作用

// My console warning
/usr/local/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.
它在8D内有效

在Solaris上:

# sudo crle -64 -l /usr/local/lib
/usr/local/lib
添加到共享库搜索路径
(参见mancrle)

我独立于源代码构建libyaml文件,并将其安装在/usr/local/lib中。RVM创建的ruby仍然没有看到它们,我只是将/usr/local/lib/libyaml*复制到~/.RVM/rubies/ruby-1.9.3-p327/lib,而不是弄脏了makefile或系统LD_LIBRARY_路径/


这平息了警告。

在CentOS 6.3上,上述各项都不起作用。然而,在安装ruby之前从源代码安装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
$ sudo make install
然后

rvm install 1.9.3
gem install rails

当我在雪豹10.6.8上从64位切换到32位时,我重新安装了ruby(使用rvm)以在32位上运行,遇到了同样的问题。所以我只是“清理”了rvm之前缓存的所有东西,并解决了问题。希望这个提示能帮助别人

rvm清理所有

rvm在此处安装ruby_version_/(这样,rvm也将重新下载最新的yaml)

顺便说一句,如果你仍然遇到这个问题,我想你可以试试:

宝石安装心理学


这就是我在Ubuntu上工作的原因:
-安装libyaml-dev(sudo-apt-get-install-libyaml-dev)
-安装我正在使用的rvm+ruby 1.9.3

rvm 1.16.20(版本), 米哈尔乳头[https://rvm.io/]

并且在bundle安装过程中也出现以下错误

.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in`:似乎 您的ruby安装缺少psych(用于YAML输出)。到 消除此警告,请安装libyaml并重新安装 鲁比

这里有三种不同的方法来解决这个错误,而不必安装psych

  • 导出LD_LIBRARY_PATH=/usr/local/lib
  • alter/etc/ld.so.conf

  • 通过以下方式修复rvm ruby 1.9.3安装

    patch.rvm/scripts/functions/manage/ruby
  • $diff-c.rvm/{src/rvm/,}脚本/functions/manage/ruby ***.rvm/src/rvm/scripts/functions/manage/ruby 2012-11-10 06:28:14.000000000+0000 ---.rvm/scripts/functions/manage/ruby 2013-01-25 17:18:00.000000000+0000 *************** *** 106,123 **** #当relative生效时,libyaml安装在ruby中,因此它将随ruby一起移动 prefix_path=“${rvm_rubies_path}/${rvm_ruby_string}”libyaml ! __rvm_update_configure_env CFLAGS=“-I${rvm_rubies_path}/${rvm_ruby_string}/include” ! __rvm_update_configure_env LDFLAGS=“-L${rvm_rubies_path}/${rvm_ruby_string}/lib” 如果[[-d“${rvm_rubies_path}/${rvm_ruby_string}/lib64”]] ! 然后uu rvm_update_configure_env LDFLAGS=“-L${rvm_rubies_path}/${rvm_ruby_string}/lib64” fi 其他的 已安装libyaml| | libyaml#安装libyaml ! __rvm_update_configure_env CFLAGS=“-I${rvm_path}/usr/include” ! __rvm_update_configure_env LDFLAGS=“-L${rvm_path}/usr/lib” 如果[[-d“${rvm_path}/usr/lib64”]] ! 然后_rvm_update_configure_env LDFLAGS=“-L${rvm_path}/usr/lib64” fi F
    # cd to your ruby source location
    rm -rf /usr/local/lib/ruby # clean out ruby files
    ./configure
    make && make install
    gem -v # check if error is fixed
    
    // My console warning
    /usr/local/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.
    
    // obviously after installing `libyaml`
    rvm remove all
    rvm install 1.9.1
    rvm use 1.9.1 --default
    
    # sudo crle -64 -l /usr/local/lib
    
    $ 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
    $ sudo make install
    
    rvm install 1.9.3
    gem install rails
    
    sudo su - root
    echo /usr/local/lib64 >> /etc/ld.so.conf
    echo /usr/local/lib >> /etc/ld.so.conf
    ldconfig
    
    patch .rvm/scripts/functions/manage/ruby < ruby-1.9.3-LDFLAGS.patch
    rvm uninstall ruby-1.9.3-p194
    export LDFLAGS='-L /usr/local/lib64 -L/usr/local/lib -Xlinker -R/usr/local/lib64 -Xlinker -R/usr/local/lib'
    rvm install ruby-1.9.3-p194 --disable-binary
    grep configure_args .rvm/src/ruby-1.9.3-p194/config.log # to confirm LDFLAG
    
    $ diff -c .rvm/{src/rvm/,}scripts/functions/manage/ruby *** .rvm/src/rvm/scripts/functions/manage/ruby 2012-11-10 06:28:14.000000000 +0000 --- .rvm/scripts/functions/manage/ruby 2013-01-25 17:18:00.000000000 +0000 *************** *** 106,123 **** # when relative is in effect libyaml is installed in ruby itself so it will be moved with ruby prefix_path="${rvm_rubies_path}/${rvm_ruby_string}" libyaml ! __rvm_update_configure_env CFLAGS="-I${rvm_rubies_path}/${rvm_ruby_string}/include" ! __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib" if [[ -d "${rvm_rubies_path}/${rvm_ruby_string}/lib64" ]] ! then __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib64" fi else libyaml_installed || libyaml # Installs libyaml ! __rvm_update_configure_env CFLAGS="-I${rvm_path}/usr/include" ! __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib" if [[ -d "${rvm_path}/usr/lib64" ]] ! then __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib64" fi fi --- 106,123 ---- # when relative is in effect libyaml is installed in ruby itself so it will be moved with ruby prefix_path="${rvm_rubies_path}/${rvm_ruby_string}" libyaml ! __rvm_update_configure_env CFLAGS="-I${rvm_rubies_path}/${rvm_ruby_string}/include ${CFLAGS}" ! __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib ${LDFLAGS}" if [[ -d "${rvm_rubies_path}/${rvm_ruby_string}/lib64" ]] ! then __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib64 ${LDFLAGS}" fi else libyaml_installed || libyaml # Installs libyaml ! __rvm_update_configure_env CFLAGS="-I${rvm_path}/usr/include ${CFLAGS}" ! __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib ${LDFLAGS}" if [[ -d "${rvm_path}/usr/lib64" ]] ! then __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib64 ${LDFLAGS}" fi fi
    sudo rm /usr/local/lib/libyaml*.*
    
    rvm reinstall ruby-2.0.0-p0
    
    $ brew doctor
    $ brew link libyaml
    
    rvm reinstall 1.9.3 --with-libyaml
    
    rvm use 1.9.3
    
    gem install psych
    
    % uname -a
    Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013  x86_64 x86_64 x86_64 GNU/Linux
    
    % cat /etc/redhat-release
    CentOS release 6.4 (Final)
    
    % wget http://apt.sw.be/redhat/el5/en/x86_64/dag/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
    % sudo rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm"
    % sudo rpm -ivh rpmforge-release-0.3.6-1.el5.rf.*.rpm"
    
    % grep rpmforge ~/.aliases
    alias rpmforge "sudo yum --disablerepo='*' --enablerepo='rpmforge'"
    
    % rpmforge install libyaml libyaml-devel
    
    % sudo yum list installed | grep libyaml
    libyaml.x86_64          0.1.4-1.el5.rf  @rpmforge                               
    libyaml-devel.x86_64    0.1.4-1.el5.rf  @rpmforge  
    
    % tar zxvf ruby-1.9.3-p448.tar.gz
    % cd ruby-1.9.3-p448
    % ./configure -prefix=$HOME/ruby-1.9.3-p448
    % make ; make install
    % cd $HOME; ln -s ./ruby-1.9.3-p448 ruby
    
    % echo $PATH
    /home/francis/ruby/bin:/usr/sbin:/home/francis/bin:/home/francis/jdk1.7.0_25/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin
    
    % which ruby
    /home/francis/ruby/bin/ruby
    
    % gem update --system
    
    % echo $GEM_HOME
    % /home/francis/ruby/lib/ruby/gems
    
    % gem install mysql2 pg ruby-debug-ide rails capistrano capistrano-ext passenger
    
    brew uninstall libyaml
    rvm autolibs enable
    rvm reinstall ruby-2.1.1
    
    yum install libyaml-devel
    
    $ brew remove --force ruby # remove all versions installed
    $ sudo rm -rf /usr/local/lib/ruby # remove all gems and leftover files
    $ brew install ruby
    $ gem install bundler
    $ bundle install
    
    rm -rf /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4
    rm -rf /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/psych-2.2.4
    
    psych (2.2.4, default: 2.2.2)