我有以下清单:
include nodejs
package { 'serve':
ensure => latest,
provider => 'npm',
}
我正在使用puppetlab node.js模块:
http://forge.puppetlabs.com/puppetlabs/nodejs
Vagrantfile:
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之前尝试安装'serve'模块,所以我尝试了require => Package[npm]
,但结果相同。
那么有人可以说明为什么不安装“服务”模块吗?
答案 0 :(得分:11)
我也遇到过这个问题 - 它看起来像puppetlabs-nodejs模块实际上并不接受ensure => latest
,这与文档相反。当我更改为ensure => present
时,我的问题已修复,代码确实支持特定版本,例如ensure => 1.12.4
。
答案 1 :(得分:8)
似乎是在排序 - 提供者需要npm
命令,你还没有。
尝试将您的清单改为:
class { 'nodejs': } -> package { 'serve': ensure => present, provider => 'npm', }
或者,可能:
include nodejs
package { 'serve':
ensure => present,
provider => 'npm',
require => Package['npm'],
}