From 9e3b021b1a7a8bef95b970810dd627ee5025659b Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 11 Dec 2023 22:56:48 +0000 Subject: [PATCH] Add help text for Node.js snap failures The official Node.js Snap as distributed via the Ubuntu Snap Store does not provide support for native modules. Sometimes, if the version of the core matches the version of the underlying OS, then it will appear to work. There are quite a few open issues relating to this in the nodejs/snap repo. --- lib/sharp.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/sharp.js b/lib/sharp.js index c002f844..129b427f 100644 --- a/lib/sharp.js +++ b/lib/sharp.js @@ -77,6 +77,12 @@ if (sharp) { ); } catch (errEngines) {} } + if (isLinux && /\/snap\/core[0-9]{2}/.test(messages)) { + help.push( + '- Remove the Node.js Snap, which does not support native modules', + ' snap remove node' + ); + } if (isMacOs && /Incompatible library version/.test(messages)) { help.push( '- Update Homebrew:',