Просмотр исходного кода

Recommended cpu detection change

Bob Mottram 7 лет назад
Родитель
Сommit
87f395376a
1 измененных файлов: 2 добавлений и 2 удалений
  1. 2
    2
      src/freedombone-utils-nodejs

+ 2
- 2
src/freedombone-utils-nodejs Просмотреть файл

@@ -63,10 +63,10 @@ function get_npm_arch {
63 63
 function nodejs_fix_cpu_detection {
64 64
     # fix for failing cpu detection during image build with qemu, see https://github.com/npm/npm/issues/19265
65 65
     if [ -f "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" ]; then
66
-        sed -i "s|require('os').cpus.*|1|g" "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js"
66
+        sed -i "s|require('os').cpus().length|(require('os').cpus() || { length: 1 }).length|g" "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js"
67 67
     fi
68 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"
69
+        sed -i "s|require('os').cpus().length|(require('os').cpus() || { length: 1 }).length|g" "$rootdir/.npm-global/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js"
70 70
     fi
71 71
     # installing worker farm fixes the cpu detection bug
72 72
     $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g worker-farm@1.6.0 --save