question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Something went wrong installing the "sharp" module

See original GitHub issue

Description

gatsby develop fails on existing site or even a new build.

Full error below:


Error in "/Users/hsnyc/Documents/Hosts/hsnyc/hsnyc_v4/hsnyc-gatsby/node_modules/gatsby-transformer-sharp/gatsby-node.js":
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'

- Run "npm rebuild --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues

  Error: Something went wrong installing the "sharp" module
  Cannot find module '../build/Release/sharp.node'
  - Run "npm rebuild --verbose sharp" and look for errors
  - Consult the installation documentation at https://sharp.pixelplumbing.com/  install
  - Search for this error at https://github.com/lovell/sharp/issues

  - constructor.js:34 Object.<anonymous>
    [hsnyc-gatsby]/[sharp]/lib/constructor.js:34:9

  - v8-compile-cache.js:178 Module._compile
    [hsnyc-gatsby]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:789 Object.Module._extensions..js
    internal/modules/cjs/loader.js:789:10

  - loader.js:653 Module.load
    internal/modules/cjs/loader.js:653:32

  - loader.js:593 tryModuleLoad
    internal/modules/cjs/loader.js:593:12

  - loader.js:585 Function.Module._load
    internal/modules/cjs/loader.js:585:3

  - loader.js:692 Module.require
    internal/modules/cjs/loader.js:692:17

  - v8-compile-cache.js:159 require
    [hsnyc-gatsby]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - index.js:3 Object.<anonymous>
    [hsnyc-gatsby]/[sharp]/lib/index.js:3:15

  - v8-compile-cache.js:178 Module._compile
    [hsnyc-gatsby]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:789 Object.Module._extensions..js
    internal/modules/cjs/loader.js:789:10

  - loader.js:653 Module.load
    internal/modules/cjs/loader.js:653:32

  - loader.js:593 tryModuleLoad
    internal/modules/cjs/loader.js:593:12

  - loader.js:585 Function.Module._load
    internal/modules/cjs/loader.js:585:3

  - loader.js:692 Module.require
    internal/modules/cjs/loader.js:692:17

  - v8-compile-cache.js:159 require
    [hsnyc-gatsby]/[v8-compile-cache]/v8-compile-cache.js:159:20


not finished load plugins - 0.330s

Steps to reproduce

Had node 8 installed when I first noticed the error. Upgraded to 12, cleared npm cache npm cache clear and gatsby cache gatsby clean. Rebuild npm rebuild --verbose sharp no errors. Downgraded to Node 10 and repeated the above steps. Same error.

Expected result

To have the local server run.

Actual result

Sharp error

Environment

System: OS: macOS Mojave 10.14.6 CPU: (4) x64 Intel® Core™ i5-5257U CPU @ 2.70GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 10.18.0 - /usr/local/bin/node npm: 6.13.4 - /usr/local/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 83.0.4103.61 Firefox: 57.0.4 Safari: 13.1 npmPackages: gatsby: ^2.21.37 => 2.21.37 gatsby-image: ^2.4.4 => 2.4.4 gatsby-plugin-manifest: ^2.4.5 => 2.4.5 gatsby-plugin-offline: ^3.2.3 => 3.2.3 gatsby-plugin-react-helmet: ^3.3.1 => 3.3.1 gatsby-plugin-sharp: ^2.6.4 => 2.6.4 gatsby-source-filesystem: ^2.3.4 => 2.3.4 gatsby-transformer-sharp: ^2.5.2 => 2.5.2 npmGlobalPackages: gatsby-cli: 2.12.36

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

25reactions
hsnyccommented, Jun 7, 2020

Well after various attempts to resolve I finally found a solution.

Here is how I was able to get it to work (Using a MAC):

  1. Completely uninstall Node and NPM by following the steps in this post.
  2. Install Node again using nvm - Here is how.
  3. On the existing project, delete node_modules and package-lock.json file. Run npm install.
  4. On new project works fine.
14reactions
dpw1commented, Jul 28, 2022

The aforementioned code did the trick for me.

npm rebuild --verbose sharp

Read more comments on GitHub >

github_iconTop Results From Across the Web

10 Answers - 10
Something went wrong installing the "sharp " module Cannot find module '../build/Release/sharp.node'. How can I fix this problem? react-native ...
Read more >
Something went wrong installing the "sharp" module (fix)
I was using Node version v14. 14.0 when I got the sharp module error and downgraded to several earlier versions without luck. Then...
Read more >
To reproduce
Something went wrong installing the "sharp " module Cannot find module '../build/Release/sharp-linux-x64.node' on Ubuntu.
Read more >
Something went wrong installing the "sharp" module
Hi everyone, I always get the error below when I install framework7. I am using nodejs version v14.15.0. Here is the error I...
Read more >
Questions and Answers
Strapi Error: Something went wrong installing the "sharp" module Cannot find module '../build/Release/sharp-linux-x64.node'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found