浏览代码

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