Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant, Puppet and nodejs module: throwing error on npm module installation

I have the following manifest:

include nodejs

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

I am using the puppetlab node.js module:

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

When I run vagrant up I am getting the following error:

[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

At first I thought maybe it's trying to install the 'serve' module before npm installed so I tried require => Package[npm] but that gave the same result.

So could anybody shine some light on why it's not installing the 'serve' module?

like image 999
Pickels Avatar asked Nov 11 '12 13:11

Pickels


2 Answers

I ran across this as well - it looks to me like the puppetlabs-nodejs module doesn't actually accept ensure => latest, which is contrary to the documentation. My issue was fixed when I changed to ensure => present, and the code does look to support specific versions as well with ensure => 1.12.4 for example.

like image 160
Logickal Avatar answered Oct 21 '22 06:10

Logickal


It seems to be ordering - the provider needs the npm command, which you don't have yet.

Try altering your manifest to something like:

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

alternatively, possibly:

include nodejs

package { 'serve':
  ensure => present,
  provider => 'npm',
  require => Package['npm'],
}
like image 42
fiddyspence Avatar answered Oct 21 '22 07:10

fiddyspence