Out of the blue, when I gatsby develop I get the message that gatsby_plugin-sharp is missing and I should probably install the package.
I never deleted this package and I was using it from the beginning.
I tried to install it again but I'm getting errors while doing so.
Install package
I get this installing gatsby-plugin-sharp:
> [email protected] install /Users/kostasvrouvas/kosvrouvascom/node_modules/gatsby-plugin-sharp/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /Users/kostasvrouvas/.npm/_libvips/libvips-8.8.1-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=11.12.0 runtime=node arch=x64 libc= platform=darwin)
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:323:16)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kostasvrouvas/kosvrouvascom/node_modules/gatsby-plugin-sharp/node_modules/sharp
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v5.0.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of [email protected] - 3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kostasvrouvas/.npm/_logs/2019-08-29T10_32_09_482Z-debug.log
System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.12.0 - /usr/local/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 6.10.1 - /usr/local/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 76.0.3809.132
Firefox: 68.0.2
Safari: 12.1.2
npmPackages:
gatsby: ^2.13.31 => 2.13.31
gatsby-image: ^2.2.8 => 2.2.8
gatsby-plugin-google-analytics: ^2.1.6 => 2.1.6
gatsby-plugin-google-fonts: ^1.0.1 => 1.0.1
gatsby-plugin-manifest: ^2.2.3 => 2.2.3
gatsby-plugin-offline: ^2.2.4 => 2.2.4
gatsby-plugin-react-helmet: ^3.1.2 => 3.1.2
gatsby-plugin-sitemap: ^2.2.9 => 2.2.9
gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
gatsby-source-filesystem: ^2.1.5 => 2.1.5
gatsby-source-wordpress: ^3.1.10 => 3.1.10
gatsby-transformer-sharp: ^2.2.6 => 2.2.6
npmGlobalPackages:
gatsby-cli: 2.7.40
Looking at the stacktrace I would try xcode-select --install
hmm, i might have uninstalled xcode but I'm sure I did days ago. So you suggest xcode is missing?
Copying node_modules/gatsby-plugin-sharp from another gatsby project and running develop, did the job, but still can't find why it threw errors.
I think you need at least the Xcode Command Line Tools because npm relies on those.
Alright I'll try this and report back 馃挭
I ve had also issues with the sharp plugin, uninstalled almost everything.
Then i installed it through Yarn instead and it worked.
my xcode was also outdated but didn't throw an error like yours.
It happened to me too, and fixed it by yarn upgrade --latest && gatsby clean
Thank you for opening this!
We're marking this issue as answered and closing it for now but please feel free to reopen this and comment if you would like to continue this discussion. We hope we managed to help and thank you for using Gatsby!
Most helpful comment
It happened to me too, and fixed it by
yarn upgrade --latest && gatsby clean