Error while generating cookbook: Missing shared library “libcrypt.so.1”

I encountered an error when trying to generate a cookbook using the command chef generate cookbook test-cookbook. The error message I received is as follows:

ERROR : exit status 127
/opt/chef-workstation/embedded/bin/ruby:  error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory

The error appears to be caused by a missing shared library called libcrypt.so.1.

How can I fix this issue and generate the cookbook successfully?