diff --git a/lib/sharp.js b/lib/sharp.js index 958748663..7d0b72ed9 100644 --- a/lib/sharp.js +++ b/lib/sharp.js @@ -19,6 +19,14 @@ try { help.push( '- Consult the installation documentation: https://sharp.pixelplumbing.com/install' ); + // Check loaded + if (process.platform === 'win32') { + const loadedModule = Object.keys(require.cache).find((i) => /[\\/]build[\\/]Release[\\/]sharp(.*)\.node$/.test(i)); + if (loadedModule) { + const [, loadedPackage] = loadedModule.match(/node_modules[\\/]([^\\/]+)[\\/]/); + help.push(`- Ensure version aligns with: "npm ls sharp". Now sharp already loaded in: "${loadedPackage}"`); + } + } console.error(help.join('\n')); process.exit(1); }