sc-mongodb icon indicating copy to clipboard operation
sc-mongodb copied to clipboard

No resource or method named 'build_essential'

Open rponcetn opened this issue 8 years ago • 4 comments

Hi guys, I have a problem trying to use the recipe. My chef version is: 12.11.18 From what I read in the issues closed, they speak of problems in the version of chef 11, but in version 12? or why do I see this error?

Error:

No resource or method named 'build_essential' for 'Chef::Recipe install

Cookbook Trace:

▽
---------------

▽
source 'https://supermarket.chef.io'
  /var/chef/cache/cookbooks/sc-mongodb/recipes/install.rb:4:in 'from_file'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:347:in 'load_recipe'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:303:in 'block in include_recipe'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:302:in 'each'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:302:in 'include_recipe'
  /var/chef/cache/cookbooks/sc-mongodb/recipes/default.rb:22:in `from_file'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:347:in 'load_recipe'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:303:in 'block in include_recipe'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:302:in 'each'
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:302:in 'include_recipe'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/sc-mongodb/recipes/install.rb:

  1:  # install the mongodb_org_repo if necessary
  2:  include_recipe 'sc-mongodb::mongodb_org_repo' if %w(10gen mongodb-org).include?(node['mongodb']['install_method'])
  3:
  4>> build_essential 'build-tools'
  5:
  6:  # prevent-install defaults, but don't overwrite
  7:  file node['mongodb']['sysconfig_file'] do
  8:    content 'ENABLE_MONGODB=no'
  9:    group node['mongodb']['root_group']
 10:    owner 'root'
 11:    mode 0644
 12:    action :create_if_missing
 13:  end

Platform:
---------
x86_64-linux

My recipe test:

node.default['mongodb']['config']['mongod']['replication']['replSetName'] = 'test'

include_recipe 'sc-mongodb::default'

rponcetn avatar Sep 14 '17 16:09 rponcetn

It's not listed in the README file, but sc-mongodb does depend on the build-essential cookbook. Toss that into your Chef environment and your run should look better

devsibwarra avatar Sep 14 '17 19:09 devsibwarra

Hi @devsibwarra, thanks for your answer. Yes, I saw that link, but I can't run recipe. This are my test:

  • metadata.rb with depends 'build_essential', '5.0.0'
name              'sc-mongo'
maintainer        'Sous Chefs'
maintainer_email  '[email protected]'
license           'Apache-2.0'
description       'Installs and configures mongodb'
long_description  'Installs and configures mongodb'
version           '1.0.0'

depends 'build-essential', '>= 5.0.0'
depends 'sc-mongodb'

supports 'ubuntu'

ERROR

I have this error:
>>>>>>     Failed to complete #converge action: [There is a dependency conflict, but the solver could not determine the precise cause in the time allotted.
Unable to find a solution for demands: 7-zip (1.0.2), apt (2.9.2), ark (3.1.0), aws (7.2.1), bluepill (2.4.3), build-essential (2.4.0)....

  • metadata.rb with only 'build_essential' (without version) and without 'build_essential', are both show the same message:
Error:
NoMethodError
-------------
No resource or method named `build_essential' for `Chef::Recipe "install"'

Cookbook Trace:
---------------
 /tmp/kitchen/cache/cookbooks/sc-mongodb/recipes/install.rb:4:in 'from_file'
 /tmp/kitchen/cache/cookbooks/sc-mongodb/recipes/default.rb:22:in 'from_file'

rponcetn avatar Sep 21 '17 16:09 rponcetn

@rponcetn The dependency conflict error is giving pretty good details on what Chef requires to run.

Some cookbook is requiring those listed cookbooks (7-zip, apt, ark, aws, etc) be installed with at least those versions.

The build-essential (2.4.0) part of the error message indicates one of your other cookbooks is requiring that specific version, or major/minor version, and it may need updated before Chef will run. I'd try searching for depends lines across all your cookbooks to locate conflicting dependencies or older lines that need updated.

devsibwarra avatar Sep 22 '17 15:09 devsibwarra

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

github-actions[bot] avatar Sep 30 '20 00:09 github-actions[bot]