安装puppet后出现以下错误:
# puppet master --version
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- json (LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/module.rb:3
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/files.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/templatewrapper.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/scope.rb:6
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/methods.rb:2
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/method_call.rb:2
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:115
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/parser.rb:11
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser.rb:4
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet.rb:282
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:12
from /usr/bin/puppet:7:in `require'
from /usr/bin/puppet:7
我的配置: 操作系统:Centos 6.5 Puppet:puppet-server-3.8.7-1.el6.noarch
# rvm list
rvm rubies
ruby-2.1.0 [ x86_64 ]
=* ruby-2.4.1 [ x86_64 ]
# ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
为什么木偶使用红宝石1.8?
答案 0 :(得分:0)
rvm未在运行puppet的用户的环境中加载,请查看您运行.bashrc
的用户的.profile
和rvm list
,然后查看相同内容木偶用户。看起来木偶用户不是rvm知道的,而是使用系统ruby。
您希望在.profile
中看到以下内容:
$ cat ~/.profile
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
可能您只为单个用户而不是系统范围设置rvm。您可能只希望为每个用户设置它,但在这种情况下,它确实需要为运行puppet的用户设置。