Defined Type: npm::install

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

Overview

Define: npm::install

Custom resource for installing node.js module dependencies

Parameters

directory

Name of the directory where to execute the install command

environment

Extra environment variables to set when running npm install

Parameters:

  • directory (Any)
  • environment (Any) (defaults to: [])


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/install.pp', line 12

define npm::install(
    $directory,
    $environment = [],
) {
    require ::npm

    exec { "${title}_npm_install":
        command     => '/usr/bin/npm install --no-bin-links',
        cwd         => $directory,
        user        => 'vagrant',
        environment => [
            "NPM_CONFIG_CACHE=${::npm::cache_dir}",
            'NPM_CONFIG_GLOBAL=false',
            'LINK=g++',
            'HOME=/home/vagrant',
        ] + $environment,
        creates     => "${directory}/node_modules",
        logoutput   => true,
    }
}