sharp: Unable to compile Sharp

What are you trying to achieve? Sharp is a dependency in a gatsby project I’m working on. Whenever I run any gatsby commands, I get the following error:

The module '<sharp module path>'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

- Ensure the version of Node.js used at install time matches that used at runtime
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues

I’ve run both npm rebuild and npm install and neither fix the issue.

Have you searched for similar questions? I noticed that issue 1689 was similar, however, I’m not using electron.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 19 (7 by maintainers)

Most upvoted comments

i installed nvm, used that to install the specific node version, then removed node_modules and package-lock.json and ran npm install

On Mon, 17 Jun 2019 at 16:53, Susana LaCoder Benavidez < notifications@github.com> wrote:

How did you recompile sharp with a specific node version? I tried npm rebuild sharp node v10.15.3 but that didn’t help so I don’t think I am running the correct command. I get the below ouput.

Something went wrong installing the “sharp” module

The module ‘/Users/susanabenavidez/.npm-global/lib/node_modules/expo-cli/node_modules/sharp/build/Release/sharp.node’ was compiled against a different Node.js version using NODE_MODULE_VERSION 67. This version of Node.js requires NODE_MODULE_VERSION 64. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lovell/sharp/issues/1746?email_source=notifications&email_token=AJFN4HN6EYJ7IJXE77CSEY3P26XPDA5CNFSM4HVYPBR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX3TVYQ#issuecomment-502741730, or mute the thread https://github.com/notifications/unsubscribe-auth/AJFN4HO3ZCFIARPAKXOQRMLP26XPDANCNFSM4HVYPBRQ .

I get this exact same issue too. I’ve tried completely removing, unlinking and pruning node and npm and re-installing, deleting node_modules folder. npm installing and npm uninstalling sharp, npm rebuilding. really not sure what’s going on but it means i can’t compile and run my gatsby site 😦

node -v v12.4.0 npm -v 6.9.0

Something went wrong installing the “sharp” module

The module ‘/node_modules/sharp/build/Release/sharp.node’ was compiled against a different Node.js version using NODE_MODULE_VERSION 67. This version of Node.js requires NODE_MODULE_VERSION 72. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).