Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Installing the Latest Node.JS And NPM Modules With Puppet

DZone's Guide to

Installing the Latest Node.JS And NPM Modules With Puppet

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

PuppetLabs’ nodejs module is unfortunately quite out of date, providing Node.js 0.6, however there is a simple way to get the latest Node:

  1. Install the puppetlabs-apt module
  2. Add ppa:chris-lea/node.js to apt
  3. Install nodejs
  4. Steal the npm provider from the puppetlabs-nodejs module
  5. Install a npm module

Code:


Stealing the npm package provider:

cd your/puppet/modules/directory
mkdir -p npm-provider/lib/puppet/provider/package
cd npm-provider/lib/puppet/provider/package
wget https://raw.github.com/puppetlabs/puppetlabs-nodejs/master/lib/puppet/provider/package/npm.rb

Puppet Code:

class prepare {
  class { 'apt': }
  apt::ppa { 'ppa:chris-lea/node.js': }
}
include prepare
 
package {'nodejs': ensure => present, require => Class['prepare'],}
 
package {'grunt-cli':
    ensure   => present,
    provider => 'npm',
    require  => Package['nodejs'],
}

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Published at DZone with permission of Jakub Holý, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}