| 
															
														 | 
														
															 
														 | 
														
															
														 | 
														
															 
														 | 
													
												
													
														| 
															63
														 | 
														
															 function nodejs_fix_cpu_detection { 
														 | 
														
															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
														 | 
														
															     # fix for failing cpu detection during image build with qemu, see https://github.com/npm/npm/issues/19265 
														 | 
													
												
													
														| 
															65
														 | 
														
															     if [ -f "$rootdir/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" ]; then 
														 | 
														
															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
														 | 
														
															     fi 
														 | 
														
															67
														 | 
														
															     fi 
														 | 
													
												
													
														| 
															68
														 | 
														
															     if [ -f "$rootdir/.npm-global/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js" ]; then 
														 | 
														
															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
														 | 
														
															     fi 
														 | 
														
															70
														 | 
														
															     fi 
														 | 
													
												
													
														| 
															71
														 | 
														
															     # installing worker farm fixes the cpu detection bug 
														 | 
														
															71
														 | 
														
															     # installing worker farm fixes the cpu detection bug 
														 | 
													
												
													
														| 
															72
														 | 
														
															     $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g worker-farm@1.6.0 --save 
														 | 
														
															72
														 | 
														
															     $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g worker-farm@1.6.0 --save 
														 |