Selaa lähdekoodia

Paths for cpu detection

Bob Mottram 7 vuotta sitten
vanhempi
commit
c29e754b22
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 5
    3
      src/freedombone-utils-nodejs

+ 5
- 3
src/freedombone-utils-nodejs Näytä tiedosto

@@ -61,10 +61,13 @@ function get_npm_arch {
61 61
 }
62 62
 
63 63
 function nodejs_fix_cpu_detection {
64
+    # fix for failing cpu detection during image build with qemu, see https://github.com/npm/npm/issues/19265
64 65
     if [ -f "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" ]; then
65
-        # fix for failing cpu detection during image build with qemu, see https://github.com/npm/npm/issues/19265
66 66
         sed -i "s|require('os').cpus.*|1|g" "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js"
67 67
     fi
68
+    if [ -f "$rootdir/.npm-global/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" ]; then
69
+        sed -i "s|require('os').cpus.*|1|g" "$rootdir/.npm-global/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js"
70
+    fi
68 71
     # installing worker farm fixes the cpu detection bug
69 72
     $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g worker-farm@1.6.0 --save
70 73
 }
@@ -139,6 +142,7 @@ function mesh_install_nodejs {
139 142
     get_npm_arch
140 143
 
141 144
     $mesh_install_nodejs_prefix npm config set unsafe-perm true
145
+    nodejs_setup_global_modules
142 146
     nodejs_fix_cpu_detection
143 147
     $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g npm@${NPM_VERSION} --save
144 148
     if [ -f "$rootdir/usr/local/bin/npm" ]; then
@@ -186,8 +190,6 @@ EOF
186 190
     fi
187 191
     rm "$rootdir/usr/bin/test_nodejs_install"
188 192
     NODE_UPGRADE=
189
-
190
-    nodejs_setup_global_modules
191 193
 }
192 194
 
193 195
 function nodejs_upgrade {