Skip to content

nodejs::npm::global_config_entry cannot work on a platform that puts npm into a different path #434

@igalic

Description

@igalic

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.19.1
  • Ruby: 2.6.5
  • Distribution: FreeBSD
  • Module version: 8.1.0

How to reproduce (e.g Puppet code you use)

  class { 'nodejs':
    nodejs_package_name => 'node12',
    npm_package_name    => 'npm-node12',
    npm_path            => '/usr/local/bin/npm'
  }

  nodejs::npm::global_config_entry { 'unsafe-perm':
    ensure => 'present',
    value  => 'true',
  }

What are you seeing

All of my nodejs::npm::global_config_entry are failing, because the code isn't made to run on anything the author didn't anticipate. but it comes down to two things:

define nodejs::npm::global_config_entry (
  Enum['present', 'absent'] $ensure = 'present',
  $config_setting                   = $title,
  $cmd_exe_path                     = $nodejs::cmd_exe_path,
  $npm_path                         = $nodejs::params::npm_path,
  $value                            = undef,
) {
  include nodejs

npm_path defaults to $nodejs::params::npm_path rather than $nodejs::npm_path, which is wrong.
$nodejs::params::npm_path for FreeBSD is also set to /usr/bin/npm rather than /usr/local/bin/npm.

next, we have a hard-coded path of /usr/bin/test, which on FreeBSD is located in /bin/test.

Both of these seem… unnecessary. If the PATH is correct, we shouldn't have to hard-code path, unless they are extremely esoteric.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions