6

我有以下清单:

include nodejs

package { 'serve':
  ensure => latest,
  provider => 'npm',
}

我正在使用 puppetlab node.js 模块:

http://forge.puppetlabs.com/puppetlabs/nodejs

流浪文件:

Vagrant::Config.run do |config|
  config.vm.box = "precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"

  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = '~/work/environments/default/'
    puppet.manifest_file = 'site.pp'
    puppet.module_path = '~/work/environments/default/modules'
  end

end

当我运行vagrant up时,我收到以下错误:

[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/site.pp...
stdin: is not a tty
err: /Stage[main]//Package[serve]/ensure: change from absent to latest failed: Could not update: Got nil value for ensure at /tmp/vagrant-puppet/manifests/site.pp:6
notice: /Stage[main]/Nodejs/Package[nodejs]/ensure: ensure changed 'purged' to 'present'
notice: /Stage[main]/Nodejs/Package[npm]/ensure: ensure changed 'purged' to 'present'
notice: Finished catalog run in 14.89 seconds

起初我以为它可能是在安装 npm 之前尝试安装“服务”模块,所以我尝试require => Package[npm]了,但结果相同。

那么有人能解释一下为什么它没有安装“服务”模块吗?

4

2 回答 2

11

我也遇到了这个问题——在我看来 puppetlabs-nodejs 模块实际上并不接受ensure => latest,这与文档相反。当我更改为 时,我的问题得到了解决ensure => present,并且代码看起来也支持特定版本ensure => 1.12.4,例如。

于 2013-05-14T21:14:09.937 回答
8

它似乎正在订购 - 提供者需要npm您还没有的命令。

尝试将您的清单更改为:

class { 'nodejs': } -> package { 'serve': ensure => present, provider => 'npm', }

或者,可能:

include nodejs

package { 'serve':
  ensure => present,
  provider => 'npm',
  require => Package['npm'],
}
于 2012-11-11T14:53:42.727 回答