Install worker-farm to fix cpu detection bug
This commit is contained in:
parent
9dc754bc96
commit
115781093c
|
@ -60,6 +60,13 @@ function get_npm_arch {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nodejs_fix_cpu_detection {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
function mesh_install_nodejs {
|
function mesh_install_nodejs {
|
||||||
mesh_install_nodejs_prefix=
|
mesh_install_nodejs_prefix=
|
||||||
if [ "$rootdir" ]; then
|
if [ "$rootdir" ]; then
|
||||||
|
@ -130,10 +137,9 @@ function mesh_install_nodejs {
|
||||||
get_npm_arch
|
get_npm_arch
|
||||||
|
|
||||||
$mesh_install_nodejs_prefix npm config set unsafe-perm true
|
$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
|
nodejs_fix_cpu_detection
|
||||||
# fix for failing cpu detection during image build with qemu, see https://github.com/npm/npm/issues/19265
|
# installing worker farm fixes the cpu detection bug
|
||||||
sed -i "s|require('os').cpus().length|1|g" "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js"
|
$mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g worker-farm@1.5.2 --save
|
||||||
fi
|
|
||||||
$mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g npm@${NPM_VERSION} --save
|
$mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g npm@${NPM_VERSION} --save
|
||||||
if [ -f "$rootdir/usr/local/bin/npm" ]; then
|
if [ -f "$rootdir/usr/local/bin/npm" ]; then
|
||||||
cp "$rootdir/usr/local/bin/npm" /usr/bin/npm
|
cp "$rootdir/usr/local/bin/npm" /usr/bin/npm
|
||||||
|
|
Loading…
Reference in New Issue