Small improvements to install error help text

This commit is contained in:
Lovell Fuller 2023-11-06 09:40:38 +00:00
parent 1915c1387e
commit cccd1635c5
2 changed files with 5 additions and 4 deletions

View File

@ -16,7 +16,7 @@ const minimumLibvipsVersion = semverCoerce(minimumLibvipsVersionLabelled).versio
const prebuiltPlatforms = [
'darwin-arm64', 'darwin-x64',
'linux-arm', 'linux-arm64', 'linux-x64',
'linux-arm', 'linux-arm64', 'linux-s390x', 'linux-x64',
'linuxmusl-arm64', 'linuxmusl-x64',
'win32-ia32', 'win32-x64'
];

View File

@ -30,7 +30,10 @@ try {
help.push('Possible solutions:');
// Common error messages
if (prebuiltPlatforms.includes(runtimePlatform)) {
const [os, cpu] = runtimePlatform.split('-');
help.push('- Add an explicit dependency for the runtime platform:');
help.push(` npm install --os=${os} --cpu=${cpu} sharp`);
help.push(' or');
help.push(` npm install --force @img/sharp-${runtimePlatform}`);
} else {
help.push(`- The ${runtimePlatform} platform requires manual installation of libvips >= ${minimumLibvipsVersion}`);
@ -57,9 +60,7 @@ try {
help.push(' yarn config set nodeLinker node-modules');
}
// Link to installation docs
if (isLinux && /Module did not self-register/.test(errLocal.message + errPackage.message)) {
help.push('- Using worker threads on Linux? See https://sharp.pixelplumbing.com/install#worker-threads');
} else if (isWindows && /The specified procedure could not be found/.test(errPackage.message)) {
if (isWindows && /The specified procedure could not be found/.test(errPackage.message)) {
help.push('- Using the canvas package on Windows? See https://sharp.pixelplumbing.com/install#canvas-and-windows');
} else {
help.push('- Consult the installation documentation: https://sharp.pixelplumbing.com/install');