From 23a6360c257393cc2a976f50248632165c6d318e Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Tue, 24 Jul 2018 11:26:12 +0200 Subject: [PATCH] Add workaround for ethercalc bug There is a bug with global npm installs[1] which causes node to be unable to find the SocialCalc.js module. We can work around it by symlinking the socialcalc module into the location that node expects to find it[2]. [1] https://github.com/audreyt/ethercalc/issues/542 [2] https://github.com/audreyt/ethercalc/issues/542#issuecomment-330039410 Change-Id: I6f751c19c772cda74f5a7b601238b4519039d257 --- manifests/init.pp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index befe402..6a284e9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -103,6 +103,20 @@ class ethercalc ( require => Anchor['nodejs-package-install'], } + # NOTE(cmurphy) Workaround global install issue + # https://github.com/audreyt/ethercalc/issues/542 + if ($use_nodejs_version == '6.x') { + file { "${base_install_dir}/node_modules/ethercalc/node_modules": + ensure => directory, + require => [File[$base_install_dir], Exec['install-ethercalc']], + } + file { "${base_install_dir}/node_modules/ethercalc/node_modules/socialcalc": + ensure => link, + target => "${base_install_dir}/node_modules/socialcalc", + require => File["${base_install_dir}/node_modules/ethercalc/node_modules"], + } + } + # TODO(ianw): remove this when trusty is dropped if $use_upstart {