Module的未定义方法

Module的未定义方法

本文介绍了使用Chef在Vagrant VM上安装Postgres的问题:Config:Module的未定义方法“ ruby​​”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我的 c之后启动时,我得到,并显示错误消息: undefined method ruby​​'for Config:Module`。

Also I used precise32 box.And while my VM starts after vagrant up, I get very long traceback with error message: undefined methodruby' for Config:Module`.

有人吗?

推荐答案

安装 pg gem似乎存在问题:

There appears to be a problem installing the "pg" gem:

================================================================================
Error executing action `install` on resource 'chef_gem[pg]'
================================================================================

Gem::Installer::ExtensionBuildError
-----------------------------------
ERROR: Failed to build gem native extension.

        /opt/vagrant_ruby/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
..
..
checking for st.h... yes
creating extconf.h
creating Makefile

make
sh: 1: make: not found

我建议阅读食谱。它建议设置 compiletime属性,以支持确保构建工具可用于编译RubyGems扩展。

I suggest reading the documentation of the build-essentials cookbook. It suggests setting the "compiletime" attribute in order to support to ensure that the build tools are available to compile RubyGems extensions.

以下json设置对我有用:

The following json settings worked for me:

chef.json = {
  "postgresql" => {
    "password" => {
      "postgres" => "password"
    }
  },
  "database" => {
    "create" => ["encased_dev"]
  },
  "build_essential" => {
    "compiletime" => true
  }
}

注意:


  • 属性是 build_essential而不是 build-essential

此后我发现有一个也解决了此问题(通过设置构建基本节点属性来解决)。可以将其添加到您的运行列表中,或使用

I have since discovered that there is a ruby recipe that fixes this issue as well (by setting the build essential node attributes about). Either add it to your run-list or use the database cookbook



  • https://github.com/opscode-cookbooks/database/blob/master/recipes/postgresql.rb

这篇关于使用Chef在Vagrant VM上安装Postgres的问题:Config:Module的未定义方法“ ruby​​”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 17:58