From 1da89f4273b3458a87965e882688a269fc8fcfdd Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Mar 2018 14:17:51 +0100 Subject: [PATCH] Ensure global node modules directory is created during upgrades --- src/freedombone-utils-nodejs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/freedombone-utils-nodejs b/src/freedombone-utils-nodejs index 29a872fd..a665c475 100755 --- a/src/freedombone-utils-nodejs +++ b/src/freedombone-utils-nodejs @@ -181,6 +181,7 @@ function nodejs_upgrade { if [ ! -f /etc/apt/sources.list.d/nodesource.list ]; then return fi + nodejs_setup_global_modules if grep -q "node_8.x" /etc/apt/sources.list.d/nodesource.list; then if [ -f /usr/local/bin/node ]; then CURR_NODE_VERSION=$(node --version) @@ -204,6 +205,9 @@ function nodejs_upgrade { } function nodejs_setup_global_modules { + if [ ! -f /usr/local/bin/node ]; then + return + fi if [ ! -d "$rootdir/root/.npm-global" ]; then mkdir "$rootdir/root/.npm-global" fi