When you try to run knife command to upload or some chef work related to a cookbook you may see below error.

$ knife cookbook upload mycookbook
ERROR: Could not find cookbook mycookbook in your cookbook path, skipping it
ERROR: Failed to upload 1 cookbook.

This is a simple error where your knife command is unable to find cookbook folder which is mentioned in its knife.rb file located in ~/.chef/. Normally knife will not upload your cookbooks if they are not in designated cookbooks folder. So we have to be careful with where you are uploading cookbooks other wise we will face this issue.

The ~/.chef/knife.rb file content

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "chef-user-1"
client_key               "#{current_dir}/chef-user-1.pem"
chef_server_url          "https://api.chef.io/organizations/learn-chef-2"
cookbook_path            ["#{current_dir}/../cookbooks"]

To resolve this check if the cookbook folder mention in  ~/.chef/knife.rb file is present or not. If it is not please create one and try the above command once again. You should not see this error.

mkdir ~/cookbooks

Now try the above command you should see one cookbook got updated with a version mention in the metadata.rb file.


$ knife cookbook upload mycookbook
Uploading mycookbook [0.1.0]
Uploaded 1 cookbook.

Please use our slack channel to ask your questions. Please register at https://join.slack.com/t/linuxnix/shared_invite/MjI2MDM2MzkxOTA2LTE1MDI2NjIwNDktNjc2MWRkN2MwYQ

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.