Defined Type: npm::global

Defined in:
puppet/modules/npm/manifests/global.pp

Overview

Define: npm::global

Resource for installing node.js modules globally

Parameters

version

Specific package version to install

Parameters:

  • version (Any) (defaults to: undef)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'puppet/modules/npm/manifests/global.pp', line 10

define npm::global (
    $version = undef,
) {
    require ::npm

    $package = $version ? {
        undef   => $title,
        default => "${title}@${version}",
    }

    exec { "npm_global_${title}":
        command     => "/usr/bin/npm install -g ${package}",
        user        => 'root',
        group       => 'root',
        creates     => "/usr/lib/node_modules/${title}",
        environment => [
            "NPM_CONFIG_CACHE=${::npm::cache_dir}",
            'NPM_CONFIG_GLOBAL=false',
            'LINK=g++',
        ],
    }
}