瀏覽代碼

Ensure global node modules directory is created during upgrades

Bob Mottram 7 年之前
父節點
當前提交
1da89f4273
共有 1 個檔案被更改,包括 4 行新增0 行删除
  1. 4
    0
      src/freedombone-utils-nodejs

+ 4
- 0
src/freedombone-utils-nodejs 查看文件

@@ -181,6 +181,7 @@ function nodejs_upgrade {
181 181
     if [ ! -f /etc/apt/sources.list.d/nodesource.list ]; then
182 182
         return
183 183
     fi
184
+    nodejs_setup_global_modules
184 185
     if grep -q "node_8.x" /etc/apt/sources.list.d/nodesource.list; then
185 186
         if [ -f /usr/local/bin/node ]; then
186 187
             CURR_NODE_VERSION=$(node --version)
@@ -204,6 +205,9 @@ function nodejs_upgrade {
204 205
 }
205 206
 
206 207
 function nodejs_setup_global_modules {
208
+    if [ ! -f /usr/local/bin/node ]; then
209
+        return
210
+    fi
207 211
     if [ ! -d "$rootdir/root/.npm-global" ]; then
208 212
         mkdir "$rootdir/root/.npm-global"
209 213
     fi