Add additional debugging hint on symbol error (#3132)

This commit is contained in:
Marvin ROGER 2022-03-14 11:19:02 +01:00 committed by GitHub
parent ac883c5215
commit 27d9fe2a4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ try {
'- Consult the installation documentation: https://sharp.pixelplumbing.com/install' '- Consult the installation documentation: https://sharp.pixelplumbing.com/install'
); );
// Check loaded // Check loaded
if (process.platform === 'win32') { if (process.platform === 'win32' || /symbol/.test(err.message)) {
const loadedModule = Object.keys(require.cache).find((i) => /[\\/]build[\\/]Release[\\/]sharp(.*)\.node$/.test(i)); const loadedModule = Object.keys(require.cache).find((i) => /[\\/]build[\\/]Release[\\/]sharp(.*)\.node$/.test(i));
if (loadedModule) { if (loadedModule) {
const [, loadedPackage] = loadedModule.match(/node_modules[\\/]([^\\/]+)[\\/]/); const [, loadedPackage] = loadedModule.match(/node_modules[\\/]([^\\/]+)[\\/]/);