mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Improve error message on Windows for version conflict (#2918)
This commit is contained in:
parent
f37ca8249a
commit
e475d9e47f
@ -19,6 +19,14 @@ try {
|
|||||||
help.push(
|
help.push(
|
||||||
'- Consult the installation documentation: https://sharp.pixelplumbing.com/install'
|
'- 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'));
|
console.error(help.join('\n'));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user