Update doc links contained within code

Throw rather than exit if require fails
This commit is contained in:
Lovell Fuller 2020-01-10 16:29:40 +00:00
parent 00bcf60566
commit a8a0c1e935
4 changed files with 15 additions and 8 deletions

View File

@ -13,6 +13,8 @@ Have you ensured the platform and version of Node.js used for `npm install` is t
If you are installing as a `root` or `sudo` user, have you tried with the `npm install --unsafe-perm` flag? If you are installing as a `root` or `sudo` user, have you tried with the `npm install --unsafe-perm` flag?
If you are using the `ignore-scripts` feature of `npm`, have you tried with the `npm install --ignore-scripts=false` flag?
What is the complete output of running `npm install --verbose sharp`? Have you checked this output for useful error messages? What is the complete output of running `npm install --verbose sharp`? Have you checked this output for useful error messages?
What is the output of running `npx envinfo --binaries --languages --system --utilities`? What is the output of running `npx envinfo --binaries --languages --system --utilities`?

View File

@ -23,7 +23,7 @@ const fail = function (err) {
npmLog.info('sharp', 'Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag'); npmLog.info('sharp', 'Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag');
} }
npmLog.info('sharp', 'Attempting to build from source via node-gyp but this may fail due to the above error'); npmLog.info('sharp', 'Attempting to build from source via node-gyp but this may fail due to the above error');
npmLog.info('sharp', 'Please see https://sharp.pixelplumbing.com/page/install for required dependencies'); npmLog.info('sharp', 'Please see https://sharp.pixelplumbing.com/install for required dependencies');
process.exit(1); process.exit(1);
}; };

View File

@ -16,15 +16,20 @@ try {
help.push('- Ensure the version of Node.js used at install time matches that used at runtime'); help.push('- Ensure the version of Node.js used at install time matches that used at runtime');
} else if (/invalid ELF header/.test(err.message)) { } else if (/invalid ELF header/.test(err.message)) {
help.push(`- Ensure "${process.platform}" is used at install time as well as runtime`); help.push(`- Ensure "${process.platform}" is used at install time as well as runtime`);
} else if (/Cannot find module/.test(err.message)) {
help.push('- Run "npm rebuild --verbose sharp" and look for errors');
} else { } else {
help.push('- Remove the "node_modules/sharp" directory, run "npm install" and look for errors'); help.push(
'- Remove the "node_modules/sharp" directory then run',
' "npm install --ignore-scripts=false --verbose" and look for errors'
);
} }
help.push( help.push(
'- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/', '- Consult the installation documentation at https://sharp.pixelplumbing.com/install',
'- Search for this error at https://github.com/lovell/sharp/issues', '' '- Search for this error at https://github.com/lovell/sharp/issues', ''
); );
console.error(help.join('\n')); const error = help.join('\n');
process.exit(1); throw new Error(error);
} }
// Use NODE_DEBUG=sharp to enable libvips warnings // Use NODE_DEBUG=sharp to enable libvips warnings

View File

@ -26,16 +26,16 @@
// Verify platform and compiler compatibility // Verify platform and compiler compatibility
#if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 9)) #if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 9))
#error libvips version 8.9.0+ is required - see sharp.pixelplumbing.com/page/install #error "libvips version 8.9.0+ is required - please see https://sharp.pixelplumbing.com/install"
#endif #endif
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6))) #if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
#error GCC version 4.6+ is required for C++11 features - see sharp.pixelplumbing.com/page/install#prerequisites #error "GCC version 4.6+ is required for C++11 features - please see https://sharp.pixelplumbing.com/install"
#endif #endif
#if (defined(__clang__) && defined(__has_feature)) #if (defined(__clang__) && defined(__has_feature))
#if (!__has_feature(cxx_range_for)) #if (!__has_feature(cxx_range_for))
#error clang version 3.0+ is required for C++11 features - see sharp.pixelplumbing.com/page/install#prerequisites #error "clang version 3.0+ is required for C++11 features - please see https://sharp.pixelplumbing.com/install"
#endif #endif
#endif #endif