我正在尝试使用厨师食谱安装乘客宝石。安装方法是“源”。 安装的ruby版本为2.2.3,并且gem二进制文件也指定为相同版本。
但是我收到此错误
STDERR: ERROR: Error installing passenger:
rake requires Ruby version >= 2.0.0.
当我尝试直接安装到测试VM时,它没有任何错误。
有什么主意吗?
厨师食谱
if node['nginx']['passenger']['install_method'] == 'package'
package node['nginx']['package_name']
package 'passenger'
elsif node['nginx']['passenger']['install_method'] == 'source'
gem_package 'passenger' do
action :install
version node['nginx']['passenger']['version']
gem_binary node['nginx']['passenger']['gem_binary'] if node['nginx']['passenger']['gem_binary']
end
node.run_state['nginx_configure_flags'] =
node.run_state['nginx_configure_flags'] | ["--add-module=#{node['nginx']['passenger']['root']}/ext/nginx"]
end
测试厨房日志如下
Recipe: nginx::passenger
* apt_package[libcurl4-gnutls-dev] action install
- install version 7.35.0-1ubuntu2.17 of package libcurl4-gnutls-dev
* gem_package[passenger] action install
================================================================================
Error executing action `install` on resource 'gem_package[passenger]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /home/local/.rvm/rubies/ruby-2.2.3/bin/gem install passenger -q --no-rdoc --no-ri -v "4.0.57" ----
STDOUT:
STDERR: ERROR: Error installing passenger:
rake requires Ruby version >= 2.0.0.
---- End output of /home/local/.rvm/rubies/ruby-2.2.3/bin/gem install passenger -q --no-rdoc --no-ri -v "4.0.57" ----
Ran /home/local/.rvm/rubies/ruby-2.2.3/bin/gem install passenger -q --no-rdoc --no-ri -v "4.0.57" returned 1
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/nginx/recipes/passenger.rb
39: gem_package 'passenger' do
40: action :install
41: version node['nginx']['passenger']['version']
42: gem_binary node['nginx']['passenger']['gem_binary'] if node['nginx']['passenger']['gem_binary']
43: end
44:
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/nginx/recipes/passenger.rb:39:in `from_file'
gem_package("passenger") do
package_name "passenger"
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
version "4.0.57"
declared_type :gem_package
cookbook_name "nginx"
recipe_name "passenger"
gem_binary "/home/local/.rvm/rubies/ruby-2.2.3/bin/gem"
end
Platform:
---------
x86_64-linux
Recipe: postfix::_common
* service[postfix] action restart
- restart service service[postfix]
Running handlers:
[2018-09-28T20:37:47+00:00] ERROR: Running exception handlers
Running handlers complete
[2018-09-28T20:37:47+00:00] ERROR: Exception handlers complete
Chef Client failed. 25 resources updated in 01 minutes 42 seconds
[2018-09-28T20:37:47+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2018-09-28T20:37:47+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-09-28T20:37:47+00:00] ERROR: gem_package[passenger] (nginx::passenger line 39) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /home/local/.rvm/rubies/ruby-2.2.3/bin/gem install passenger -q --no-rdoc --no-ri -v "4.0.57" ----
STDOUT:
STDERR: ERROR: Error installing passenger:
rake requires Ruby version >= 2.0.0.
---- End output of /home/local/.rvm/rubies/ruby-2.2.3/bin/gem install passenger -q --no-rdoc --no-ri -v "4.0.57" ----
Ran /home/local/.rvm/rubies/ruby-2.2.3/bin/gem install passenger -q --no-rdoc --no-ri -v "4.0.57" returned 1
[2018-09-28T20:37:47+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)