Ensure global node modules directory is created during upgrades

This commit is contained in:
Bob Mottram 2018-03-30 14:17:51 +01:00
parent 68f94f498e
commit 1da89f4273
1 changed files with 4 additions and 0 deletions

View File

@ -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