From 04c31b35a7e2d88931e1cb7cde0fe1720e4685b7 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Sun, 15 May 2022 19:43:45 +0100 Subject: [PATCH] Install: warn about filesystem owner running npm v8+ as root --- install/libvips.js | 4 +++- lib/sharp.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/install/libvips.js b/install/libvips.js index a3ef084f6..dbe2f2d62 100644 --- a/install/libvips.js +++ b/install/libvips.js @@ -43,7 +43,9 @@ const installationForced = !!(process.env.npm_config_sharp_install_force || proc const fail = function (err) { libvips.log(err); if (err.code === 'EACCES') { - libvips.log('Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag'); + libvips.log('Are you trying to install as a root or sudo user?'); + libvips.log('- For npm <= v6, try again with the "--unsafe-perm" flag'); + libvips.log('- For npm >= v8, the user must own the directory "npm install" is run in'); } libvips.log('Please see https://sharp.pixelplumbing.com/install for required dependencies'); process.exit(1); diff --git a/lib/sharp.js b/lib/sharp.js index 9c8657805..7a7078d9a 100644 --- a/lib/sharp.js +++ b/lib/sharp.js @@ -13,7 +13,7 @@ try { } else { const [platform, arch] = platformAndArch.split('-'); help.push( - '- Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"', + '- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"', `- Install for the current ${platformAndArch} runtime: "npm install --platform=${platform} --arch=${arch} sharp"` ); }