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
This commit is contained in:
Colleen Murphy 2018-07-24 11:26:12 +02:00
parent fe5d375e4a
commit 23a6360c25
1 changed files with 14 additions and 0 deletions

View File

@ -103,6 +103,20 @@ class ethercalc (
require => Anchor['nodejs-package-install'], 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 # TODO(ianw): remove this when trusty is dropped
if $use_upstart { if $use_upstart {