我完美地在Ubuntu 16(opsworks)上运行了一个项目。我正在升级到ubuntu 18,但是在其中一个厨师食谱中出现以下错误。
Error executing action run on resource 'execute[Updating Rubygems to 2.5.0]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '127'
---- Begin output of /usr/bin/env LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 /usr/local/bin/ruby --disable-gems setup.rb --no-rdoc --no-ri ----
STDOUT:
STDERR: /usr/bin/env: ‘/usr/local/bin/ruby’: No such file or directory
---- End output of /usr/bin/env LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 /usr/local/bin/ruby --disable-gems setup.rb --no-rdoc --no-ri ----
Ran /usr/bin/env LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 /usr/local/bin/ruby --disable-gems setup.rb --no-rdoc --no-ri returned 127
原因是,尽管有安装红宝石的配方,但没有安装红宝石。见
execute "Updating Rubygems to #{node[:rubygems][:version]}" do
command node[:rubygems][:setup_command]
cwd "/opt/rubygems-#{node[:rubygems][:version]}"
umask 022
only_if do
::File.exists?("/opt/rubygems-#{node[:rubygems][:version]}")
end
end
remote_file "/opt/ruby-#{node[:ruby][:version]}.tar.gz" do
not_if "/usr/local/bin/ruby -v | grep #{node[:ruby][:version]}"
source "http://cache.ruby-lang.org/pub/ruby/#{node[:ruby][:version][0..2]}/ruby-#{node[:ruby][:version]}.tar.gz"
notifies :run, 'bash[install ruby]', :immediately
end
bash 'install ruby' do
user 'root'
cwd '/opt'
code <<-EOH
tar --no-same-owner -zxf ruby-#{node[:ruby][:version]}.tar.gz
(cd ruby-#{node[:ruby][:version]}/ && ./configure && make && make install)
EOH
action :nothing
end
include_recipe "rubygems"
任何想法,为什么我会收到错误消息?