js3dev
js3dev

Reputation: 593

Chef require gems from recipe gives LoadError

I am using the database cookbook on an ubuntu virtual server.

When trying to create a postgresql database the script throws a LoadError: cannot load such file -- pg

I've already installed pg by doing:

chef_gem 'pg' do
  action :install
end

But the chef ruby binary can't find the gems I install through chef_gem. This happens with any gem I install.

How can I import the gems? Am I missing something?

I am running: Chef Client, version 11.8.2 Ubuntu 12.04 LTS

Upvotes: 1

Views: 1394

Answers (2)

Sbal
Sbal

Reputation: 443

You might need some of the packages

libxml2-devel
libxslt
libxslt-devel

Installing these yum packages helped me when I had got a similar error.

Upvotes: 0

Holger Just
Holger Just

Reputation: 55888

The easiest solution would be to include the database::postgresql recipe into your runlist. It in turn uses the postgresql::ruby recipe to install the pg gem into your Omnibus Ruby.

As you can see in the latter recipe, the actual installation can be a bit complicated depending on the environment. But as that is taken care of already, it shouldn't be a problem here.

Upvotes: 3

Related Questions