From 9dc754bc96b4d53551beaec6e437c1dd976a0879 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 2 Apr 2018 15:05:58 +0100 Subject: [PATCH] Fix for failing cpu detection during build --- src/freedombone-utils-nodejs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/freedombone-utils-nodejs b/src/freedombone-utils-nodejs index 9991d418..8ec31efe 100755 --- a/src/freedombone-utils-nodejs +++ b/src/freedombone-utils-nodejs @@ -37,7 +37,7 @@ VARIANTS='mesh' # have specifically the correct versions NODEJS_VERSION='8.11.1' NODEJS_N_VERSION='2.1.7' -NPM_VERSION='5.8.0' +NPM_VERSION='5.6.0' # This file keeps track of the apps needing nodejs # so that it can be removed if tere are no apps which need it @@ -130,6 +130,10 @@ function mesh_install_nodejs { get_npm_arch $mesh_install_nodejs_prefix npm config set unsafe-perm true + 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().length|1|g" "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" + fi $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g npm@${NPM_VERSION} --save if [ -f "$rootdir/usr/local/bin/npm" ]; then cp "$rootdir/usr/local/bin/npm" /usr/bin/npm