voxpupuli / puppet-nodejs

Puppet module to install nodejs and global npm packages
https://forge.puppet.com/puppet/nodejs
Apache License 2.0
113 stars 247 forks source link

Always installs node '0.10.42', but need '5.x', and npm #208

Closed jeff1evesque closed 8 years ago

jeff1evesque commented 8 years ago

I have the following puppet modules:

$ sudo puppet module install puppetlabs-vcsrepo --version 1.3.0
$ sudo puppet module install treydock-gpg_key
$ sudo puppet module install puppetlabs-stdlib --version 4.6.0
$ sudo puppet module install maestrodev-wget --version 1.7.1
$ sudo puppet module install stahnma-epel --version 1.2.2
$ sudo puppet module install puppet-nodejs --version 1.3.0
$ sudo puppet module install puppetlabs-mysql --version 3.6.2
$ sudo puppet module install puppetlabs-concat --version 2.1.0
$ sudo puppet module install puppetlabs-apache --version 1.8.1
$ sudo puppet module install crayfishx-firewalld --version 2.1.0
$ sudo puppet module install willdurand-composer --version 1.1.1
$ sudo puppet module install previousnext-drush --version 0.1.1

Then, I have configure_compilers.pp:

...
## install nodejs dependencies
class install_nodejs_dependencies {
    include stdlib
    include wget
}

## install nodejs: to use npm
class install_nodejs {
    ## set dependency
    require install_nodejs_dependencies

    class { 'nodejs':
        repo_url_suffix => '5.x',
    }
}

## install necessary packages
class install_packages {
    ## set dependency
    require install_nodejs_dependencies
    require install_nodejs

    ## variables
    $packages_general  = ['inotify-tools', 'ruby']
    $packages_npm      = ['uglify-js', 'node-sass', 'imagemin']

    ## packages: install general packages (apt, yum)
    package { $packages_general:
        ensure => 'installed',
        before => Package[$packages_npm],
    }

    ## packages: install general packages (npm)
    package {$packages_npm:
        ensure => 'installed',
        provider => 'npm',
    }
}
...
## constructor
class constructor {
    contain install_nodejs_dependencies
    contain install_nodejs
...
}
include constructor

When, I do puppet apply configure_compilers, I get the following error traceback:

[root@centos7x manifests]# puppet apply configure_compilers.pp
Notice: Compiled catalog for ****.****.****.****.*** in environment production in 1.56 seconds
Notice: /Stage[main]/Nodejs::Install/Package[nodejs]/ensure: created
Error: Command npm is missing
Error: /Stage[main]/Install_packages/Package[uglify-js]/ensure: change from absent to present failed: Command npm is missing
Error: Command npm is missing
Error: /Stage[main]/Install_packages/Package[node-sass]/ensure: change from absent to present failed: Command npm is missing
Error: Command npm is missing
Error: /Stage[main]/Install_packages/Package[imagemin]/ensure: change from absent to present failed: Command npm is missing
...
[root@centos7x manifests]# node -v
v0.10.42
[root@centos7x manifests]# puppet -V
4.3.2
jeff1evesque commented 8 years ago

I probably can remove ruby from configure_compilers.pp:

...
    ## variables
    $packages_general  = ['inotify-tools', 'ruby']
...
jeff1evesque commented 8 years ago

I checked to see if I had epel enabled:

[root@centos7x manifests]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
--2016-03-03 16:04:00--  http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
Connecting to 10.97.74.24:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 14524 (14K) [application/x-rpm]
Saving to: ‘epel-release-7-5.noarch.rpm’

100%[==========================>] 14,524      --.-K/s   in 0s

2016-03-03 16:04:00 (228 MB/s) - ‘epel-release-7-5.noarch.rpm’ saved [14524/14524]

[root@centos7x manifests]# rpm -ivh epel-release-7-5.noarch.rpm         Preparing...                          ################################# [100%]
        package epel-release-7-5.noarch is already installed
jeff1evesque commented 8 years ago

I checked to see if I had remi enabled:

[root@centos7x manifests]# wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
--2016-03-03 16:06:26--  http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Connecting to 10.97.74.24:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 7611 (7.4K) [application/x-rpm]
Saving to: ‘remi-release-7.rpm’

100%[==========================>] 7,611       --.-K/s   in 0s

2016-03-03 16:06:26 (642 MB/s) - ‘remi-release-7.rpm’ saved [7611/7611]

[root@centos7x manifests]# sudo rpm -Uvh remi-release-7*.rpm
Preparing...                          ################################# [100%]
        package remi-release-7.1-3.el7.remi.noarch is already installed
jeff1evesque commented 8 years ago

The above issue was related to a proxy, so I did:

$ export https_proxy=http://xx.xx.xx.xx:xxxx

Then, I removed the puppet nodejs module, and did yum remove nodejs. Finally, the following worked:

$ puppet module install puppet-nodejs --version 1.3.0
$ puppet apply configure_compilers.pp