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.

Unable to install sharp while running yarn

See original GitHub issue

This is the setup of gatsby that I’m working with:

    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 80.0.3987.149
    Firefox: 74.0
    Safari: 13.1
  npmPackages:
    gatsby: ^2.20.6 => 2.20.6
    gatsby-image: ^2.3.1 => 2.3.1
    gatsby-plugin-catch-links: ^2.2.1 => 2.2.1
    gatsby-plugin-google-analytics: ^2.2.2 => 2.2.2
    gatsby-plugin-manifest: ^2.3.2 => 2.3.2
    gatsby-plugin-offline: ^3.1.1 => 3.1.1
    gatsby-plugin-postcss: ^2.2.0 => 2.2.0
    gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0
    gatsby-plugin-s3: ^0.3.2 => 0.3.2
    gatsby-plugin-sharp: ^2.5.3 => 2.5.3
    gatsby-plugin-sitemap: ^2.3.1 => 2.3.1
    gatsby-plugin-styled-components: ^3.2.1 => 3.2.1
    gatsby-plugin-typescript: ^2.3.1 => 2.3.1
    gatsby-plugin-zopfli: ^1.3.2 => 1.3.2
    gatsby-source-filesystem: ^2.2.1 => 2.2.1
    gatsby-source-graphql: ^2.3.0 => 2.3.0
    gatsby-transformer-sharp: ^2.4.2 => 2.4.2

This is the error that comes up when I run yarn (there’s more to the error log that hasn’t been included here):

#include <vips/vips8>
         ^~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/Personal/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/Users/Personal/.nvm/versions/node/v10.16.0/bin/node" "/Users/Personal/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/Personal/Desktop/calisthenics-skills/node_modules/sharp

I’ve already tried the following:

  • Uninstalling and reinstalling expo-cli
  • Using different version of node (10.16.0 and 12.14.1)
  • Adding resolutions(minipass v2.7.0) for the sharp dependencies in the package.json file
  • Clearing yarn cache and running yarn after that
  • Deleting node_modules and yarn.lock and running yarn after that.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
suhaga15commented, Mar 26, 2020

I tried installing vips manually using brew but that did not seem to help and we stopped trying that after realizing @andrico1234 does not have vips installed

I was actually going to suggest uninstalling it if it was installed already 🙂. It’s been known to cause problems if there’s a version installed already that sharp isn’t expecting.

Can you see if ~/.npm/_libvips exists? That is the place sharp expects libvips to be cached

Yes ~/.npm/_libvips was present. I deleted it and ran yarn and it completed successfully. Thanks a lot for the solution

2reactions
Js-Brechtcommented, Mar 26, 2020

I tried installing vips manually using brew but that did not seem to help and we stopped trying that after realizing @andrico1234 does not have vips installed

I was actually going to suggest uninstalling it if it was installed already 🙂. It’s been known to cause problems if there’s a version installed already that sharp isn’t expecting.

Can you see if ~/.npm/_libvips exists? That is the place sharp expects libvips to be cached

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't install Sharp - node.js - Stack Overflow
So first the error says Permission denied. install it using sudo when you use sudo in the sharp documentation! it says that you...
Read more >
Npm install command failing with message "could not find ...
I was following the project setup. When I run the npm install command, npm starts downloading the dependencies. But then, suddenly, it stops ......
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 I...
Read more >
Cannot find module 'sharp' error in Node.js [Solved] | bobbyhadz
The error "Cannot find name 'sharp'" occurs when we import the sharp module before installing it. To solve the error, install the sharp...
Read more >
Debugging "Make Failed with Exit Code 2" Error - CodeForGeek
Try to remove the package-lock.json file and remove node modules folder too. Then re-install the modules. rm -rf package-lock.json rm -rf ...
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