From c29e754b222cc83cffb73a13d33b472a8c8dbf31 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 2 Apr 2018 22:52:32 +0100 Subject: [PATCH] Paths for cpu detection --- src/freedombone-utils-nodejs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/freedombone-utils-nodejs b/src/freedombone-utils-nodejs index 55ac53e1..c6190c46 100755 --- a/src/freedombone-utils-nodejs +++ b/src/freedombone-utils-nodejs @@ -61,10 +61,13 @@ function get_npm_arch { } function nodejs_fix_cpu_detection { + # fix for failing cpu detection during image build with qemu, see https://github.com/npm/npm/issues/19265 if [ -f "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" ]; then - # fix for failing cpu detection during image build with qemu, see https://github.com/npm/npm/issues/19265 sed -i "s|require('os').cpus.*|1|g" "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" fi + if [ -f "$rootdir/.npm-global/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" ]; then + sed -i "s|require('os').cpus.*|1|g" "$rootdir/.npm-global/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" + fi # installing worker farm fixes the cpu detection bug $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g worker-farm@1.6.0 --save } @@ -139,6 +142,7 @@ function mesh_install_nodejs { get_npm_arch $mesh_install_nodejs_prefix npm config set unsafe-perm true + nodejs_setup_global_modules nodejs_fix_cpu_detection $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g npm@${NPM_VERSION} --save if [ -f "$rootdir/usr/local/bin/npm" ]; then @@ -186,8 +190,6 @@ EOF fi rm "$rootdir/usr/bin/test_nodejs_install" NODE_UPGRADE= - - nodejs_setup_global_modules } function nodejs_upgrade {