3

Installing Latest Node.JS And NPM Modules With Puppet

 2 years ago
source link: https://blog.jakubholy.net/2013/06/21/installing-latest-node-js-and-npm-modules-with-puppet/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Installing Latest Node.JS And NPM Modules With Puppet

June 21, 2013
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'], }

Are you benefitting from my writing? Consider buying me a coffee or supporting my work via GitHub Sponsors. Thank you! You can also book me for a mentoring / pair-programming session via Codementor or (cheaper) email.

Allow me to write to you!

Let's get in touch! I will occasionally send you a short email with a few links to interesting stuff I found and with summaries of my new blog posts. Max 1-2 emails per month. I read and answer to all replies.

Copyright © 2022 Jakub Holý
Powered by Cryogen
Theme by KingMob

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK