Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby-plugin-sharp dependency problem? #1754

Closed
bvaughn opened this issue Aug 9, 2017 · 53 comments
Closed

gatsby-plugin-sharp dependency problem? #1754

bvaughn opened this issue Aug 9, 2017 · 53 comments

Comments

@bvaughn
Copy link
Contributor

bvaughn commented Aug 9, 2017

  • Gatsby version: 1.7.2
  • Node.js version: 8.2.1
  • OS version: 10.12.16

I've ran into a problem after doing a clean install of this project. npm run dev failed with:

⠂ source and transform .../www/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

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

Looked like a dependency was missing. (I'm not sure why sharp didn't install initially, given it is listed as a dependency of gatsby-plugin-sharp.) Either way, I manually installed it (npm i --save sharp) and re-ran npm run dev. This time it failed with:

⠂ source and transform .../www/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

Error: .../www/node_modules/sharp/build/Release/sharp.node, 1): Library not loaded: @rpath/libvips-cpp.42.dylib
  Referenced from: .../www/node_modules/sharp/build/Release/sharp.node
  Reason: Incompatible library version: sharp.node requires version 50.0.0 or later, but libvips-cpp.42.dylib provides version 49.0.0

I'm not familiar with either of these dependencies- but I looked at the gatsby-plugin-sharp package.json file and saw it was depending on sharp ^0.17.3. My locally installed sharp was 0.18.12. This should be compatible but I decided to downgrade to 0.17.3 anyway and after doing so- the errors above went away.

Edit 1: It looks like any of the 0.18.* versions fail with a node-gyp error. Perhaps this failure causes the install to fail silently for some reason, which may be why sharp is missing after a fresh install. Maybe you want to remove the "^" from your version specifier?

Unfortunately npm run dev now seems to consume a lot of memory and hang after the following:

$ npm run dev

> react-website@0.0.1 dev /Users/bvaughn/Documents/git/react/www
> gatsby develop

success open and validate gatsby-config.js — 0.006 s
success copy gatsby files — 0.023 s
⠁ source and transform nodesWarning: No slug found for "README.md". Falling back to default "/README.html".
Warning: No slug found for "index.md". Falling back to default "/index.html".
success source and transform nodes — 1.433 s
success building schema — 0.441 s
success createLayouts — 0.021 s
success createPages — 0.430 s
success createPagesStatefully — 0.027 s
success extract queries from components — 0.192 s
success run graphql queries — 9.198 s
success write out page data — 0.017 s
success update schema — 62.771 s

bootstrap finished, time since started: 76.526 s

### Hung here for at least a couple of minutes.
### Terminal is unresponsive (even to Ctrl+C).

Next I tried uninstalling gatsby-transformer-sharp and gatsby-plugin-sharp and removing them from my gatsby-config. After doing this, npm run dev worked (in that it quickly spun up an HTTP server, although the remark plugin logged an error about the missing sharp plugin).

Then I tried re-adding gatsby-transformer-sharp (npm i --save gatsby-transformer-sharp) and I was still able to start the dev-server.

Lastly I tried re-adding gatsby-plugin-sharp (npm i --save gatsby-plugin-sharp) and the dev server now hangs instead of starting up.

Any chance you have an idea what might be going on? Any debug/log output I could provide that might shed some light?

Edit 2: For what it's worth, I tried stepping Node down from 8.2.1 to 7.9.0 (another version I had installed) and re-npm-installing. (It seemed worth trying because this was the version of Node I was using a few weeks ago, when I first setup the Gatbsy site.) And sure enough, the server no longer hung after that- although things still look funky. I will keep investigating this and update the issue with my findings.

Edit 3: I'm losing my mind 😅 I did another clean install and now the dev server started up okay. Something seems to be going on with my machine, given the indeterminate behavior here, so I'm going to close this issue. I may still update it with my findings if I'm able to get to the bottom of this is a satisfactory manor.

@bvaughn bvaughn closed this as completed Aug 9, 2017
@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 15, 2017

Just did yarn upgrade-interactive and ran back into this issue 😆

[5/5] 📃  Building fresh packages...
[1/4] ⠄ fsevents
[2/4] ⠄ uws
[3/4] ⠄ pngquant-bin
[4/4] ⠄ sharp
[1/4] ⠁ fsevents
[1/4] ⠄ fsevents
[-/4] ⠈ waiting...
[2/4] ⠈ uws
[3/4] ⠈ pngquant-bin
[4/4] ⠈ sharp
[-/4] ⠁ waiting...
[-/4] ⠁ waiting...
[3/4] ⠁ pngquant-bin
[4/4] ⠁ sharp
error /Users/bvaughn/Documents/git/react/www/node_modules/sharp: Command failed.
Exit code: 127
Command: sh
Arguments: -c node-gyp rebuild
Directory: /Users/bvaughn/Documents/git/react/www/node_modules/sharp
Output:
sh: node-gyp: command not found

$ yarn add node-gyp
[5/5] 📃  Building fresh packages...
success Saved 1 new dependency.
└─ node-gyp@3.6.2
✨  Done in 5.43s.

$yarn dev
error UNHANDLED EXCEPTION


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

  - module.js:11 require
    internal/module.js:11:18

  - constructor.js:8 Object.<anonymous>
    [www]/[sharp]/lib/constructor.js:8:15

  - module.js:11 require
    internal/module.js:11:18

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

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 15, 2017

FYI I tried a couple of clean installs of node_modules (even with yarn cache clean in between) but no love. However I just tried backing Node down from 8.2 to 7.9 with NVM and yarn install at least finished successfully this time. However, gatsby develop runs for ~2 minutes and then logs "bootstrap finished" and hangs.

@KyleAMathews
Copy link
Contributor

So on the hanging issue. I have seen that. Haven't yet tried to debug it. From what I've found is if you kill the process and then restart it it starts quickly the second time.

@jharris4
Copy link

@bvaughn not sure if it helps, but I ran into issues with yarn after upgrading to node 8 and npm 5.

It seems that node-gyp was bundled with node 7 but not with node 8.

Doing npm install -g node-gyp resolved the issues for me.

Here's the yarn issue: yarnpkg/yarn#3728

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

Thanks for the tip @jharris4!

Unfortunately I've tried downgrading to Node 7 (via NVM) and globally installing node-gyp but the result is the same- Gatsby hangs on startup afterward.

Killing the process and re-starting it as @KyleAMathews mentions does show "bootstrap finished" in a few seconds rather than ~2 minutes but the contents of .cache seem busted (maybe b'c of killing it in the middle?)

Even if it did resolve the cache issue, it's a pretty unsatisfying work-around. What if this happens on CI? or for other contributors? ☹️

@KyleAMathews
Copy link
Contributor

Even if it did resolve the cache issue, it's a pretty unsatisfying work-around. What if this happens on CI? or for other contributors?

For shizzle. This didn't used to happen so it's some sort of timing whatever thing. It should be pretty easy to debug so let's get it fixed soon. It doesn't seem to show up except on larger sites so I haven't worried about it as much given other tasks at hand.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

Of course! I didn't mean to sound complainy. (Hopefully I didn't!) 😄 Was just thinking out loud.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

This morning gatsby develop ran until "Compiled successfully" but the rendered page seems to be missing most of its content. (The only thing served up is the header file and most of the CSS styles are also missing.) 😅

I tried stepping back to before the dependency bump (6a55b33) and re-installing but this time, the only thing rendered on the page, was the footer.

Next I deleted the .cache directory and restarted Gatsby again and now it seems to be stuck (~90 seconds to "bootstrap finished" and then stuck- for a couple of minutes now). My guess is that whatever causes it to hang seems to leave the .cache dir in a corrupted state.

FWIW I've tried this on Node 7.9.0, 8.2.0, and 8.4.0.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

🤣 I left it running and stepped away from my computer. When I returned:

info bootstrap finished - 87.909 s


<--- Last few GCs --->

[69252:0x102801600]   275709 ms: Mark-sweep 1402.4 (1510.2) -> 1402.3 (1479.2) MB, 1451.0 / 0.0 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1451 ms) last resort
[69252:0x102801600]   277163 ms: Mark-sweep 1402.3 (1479.2) -> 1402.3 (1479.2) MB, 1454.0 / 0.0 ms  last resort


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x8e87721cef1 <JSObject>
    0: builtin exit frame: parse(this=0x8e87722e341 <JSON map = 0x3bce7810ec79>,0xd26f6770011 <String[81]: {"filter":{"fields":{"slug":{"eq":"/blog/2013/08/26/community-roundup-7.html"}}}}>)

    2: /* anonymous */(aka /* anonymous */) [/Users/bvaughn/Documents/git/react/www/node_modules/gatsby/dist/schema/run-sift.js:27] [bytecode=0x885d68cddf1 offset=81](this=0x8e877202241 <undefined>,_ref=0x3f...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 4: v8::internal::Factory::NewTransitionArray(int) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 5: v8::internal::TransitionArray::Insert(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Map>, v8::internal::SimpleTransitionFlag) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 6: v8::internal::Map::CopyReplaceDescriptors(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::DescriptorArray>, v8::internal::Handle<v8::internal::LayoutDescriptor>, v8::internal::TransitionFlag, v8::internal::MaybeHandle<v8::internal::Name>, char const*, v8::internal::SimpleTransitionFlag) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 7: v8::internal::Map::CopyAddDescriptor(v8::internal::Handle<v8::internal::Map>, v8::internal::Descriptor*, v8::internal::TransitionFlag) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 8: v8::internal::Map::CopyWithField(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::FieldType>, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::Representation, v8::internal::TransitionFlag) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
 9: v8::internal::Map::TransitionToDataProperty(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::Object::StoreFromKeyed) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
10: v8::internal::LookupIterator::PrepareTransitionToDataProperty(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::StoreFromKeyed) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
11: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
12: v8::internal::JSObject::DefineOwnPropertyIgnoreAttributes(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::JSObject::AccessorInfoHandling) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
13: v8::internal::JSObject::DefinePropertyOrElementIgnoreAttributes(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
14: v8::internal::JsonParser<true>::ParseJsonObject() [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
15: v8::internal::JsonParser<true>::ParseJsonValue() [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
16: v8::internal::JsonParser<true>::ParseJson() [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
17: v8::internal::Builtin_Impl_JsonParse(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/bvaughn/.nvm/versions/node/v8.4.0/bin/node]
18: 0x2a0caf9bc8dd

@KyleAMathews
Copy link
Contributor

You hit node's heap limit. Try raising that.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

Sure. But that's not expected, right? I was just mentioning it in case the unexpected memory usage was informative. 😄

I'm also not sure of how to increase Node's heap size in this context (short of aliasing npm on my system to run via node with a flag) but I'm sure I can figure that out. 😁

@KyleAMathews
Copy link
Contributor

Nope. I'll look into it soon.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

Yeah, no hurry at all. Just leaving a log here of everything to make it easier for you/me/whoever to reference later. 😄

I tried restarting my system to rule out any wonkiness but that didn't help. After killing gatsby develop just now I'm picking through the contents of the .cache directory, b'c I was starting to wonder if it was slurping in more than it should, and I noticed redux-state.json seemed suspiciously large (2.5M) but maybe that's not surprising. Otherwise the contents of the folder look reasonable at a glance.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

I'm increasingly confident this broke with a specific, recent commit. I'm going to bisect the react Gatsby branch and will report back soon.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 16, 2017

This ended up being caused by a more recent change than I suspected.

I stepped back a couple of weeks ago and everything seemed okay. Then I stepped forward about a day at a time. After checking out each revision, I ran:
rm -rf ./.cache && rm -rf ./.node_modules && yarn install && yarn dev.

Turns out that things went bad with this recent commit: 6a55b33. The commit before it (b6fb888) works fine, assuming I first install node-gyp as a global (which is kind of clowny but that's a separate issue).

The reason I saw the same hanging behavior toward the end of my initial issue was b'c I also ran yarn upgrade-interactive locally in an attempt to see if my original issue had already been fixed.

So one of the bumped dependencies seems to have caused this new permanently-hanging behavior. I'll try to step through individual plugins next.

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 17, 2017

Picked this back up this morning. Decided to identify the offending module by upgrading each (Gatsby + plugin + transform) individually and then do a clean build afterward.

It looks like the hanging behavior is caused by the gatsby package itself, somewhere between 1.3.2 and 1.8.11.

bvaughn added a commit to bvaughn/react that referenced this issue Aug 17, 2017
@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 17, 2017

Narrowed it down further to gatsby@1.7.0 (so likely somewhere in here). I'll file a new issue about this since this one has gotten pretty noisy. 😄

@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 22, 2018

This issue has come up again. All of the reactjs Netlify builds have been failing this week with the same error. They work only if I re-run without cache.

Has anything changed recently on the Gatsby side that would account for this?

I don't have the bandwidth to dig into it at the moment, but will try to find some time soonish.

@nickeblewis
Copy link

I’ve had similar issues with builds for my website this week and likewise I’ve not had much time to investigate. If I get the time, I will try running a similar debugging process to see if it’s the same as reported by other people in this thread.

@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 22, 2018

If you beat me to it, I'd be grateful for any notes you left here about your findings :)

@KyleAMathews
Copy link
Contributor

Nothing has changed here — Netlify did an update to their Docker build image I believe which updated Yarn and other things which might be affecting things. But none of our sites e.g. gatsbyjs.org were affected (though I think we explicitly set the YARN_VERSION though).

@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 23, 2018

though I think we explicitly set the YARN_VERSION though

You're doing this via the "Build environment variables"?

@KyleAMathews
Copy link
Contributor

Yeah.

BTW, does it build locally? Or are you having troubles there too?

@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 23, 2018

Sharp has on again, off again caused pain for me locally too. I think we've chatted about it a time or two. Generally a clean install fixes it.

@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 23, 2018

Which Yarn version are you pinned to btw

@fk
Copy link
Contributor

fk commented Feb 23, 2018

FWIW (might be unrelated) I also had a project using Yarn 0.27.5 in netlify.toml. Last week I decided to bump that to the latest stable Yarn—which I think was 1.3.0 at the time—and ran into build problems with Netlify after that. Then I stumbled upon #3570 and according to the information there gave Yarn 1.4.0 a try, but still had issues. I followed 3570#issuecomment-363591653 by @lourd to yarnpkg/yarn#5152 (comment) and edited netlify.toml accordingly, adding --no-ignore-optional:

[build]
  command = "yarn run build"
  publish = "public"

[build.environment]
  NODE_VERSION = "9.5.0"
  YARN_VERSION = "1.4.0"
  YARN_FLAGS = "--no-ignore-optional"

After that things built fine again on Netlify without having to manually purge the cache.

@devdigital
Copy link
Contributor

sharp 0.20.0 is now released, do you have an ETA on the plugin using the updated version? thanks

@m-allanson
Copy link
Contributor

@devdigital It should be fairly soon, see #4365

@osartun
Copy link
Contributor

osartun commented Nov 26, 2018

Just FYI: I'm also running into this when I start the development server. So, whatever the reason is was either not entirely fixed or there's a new reason why there are problems with sharp.
Previously I just had the develop command in package.json altered to:

"develop": "rm -rf ./.cache && gatsby develop"

Removing the cache was fine because we only recently started developing the site and we didn't have that much data in the cache.

However, now I'm adding gatsby-source-wordpress to pull in the data from the old website and clearing the cache with every startup would likely significantly increase the startup time.
So, I'm looking for a different solution now.

This is the error I'm getting multiple times when starting the gatsby development server without clearing the cache beforehand:

error Plugin gatsby-transformer-sharp returned an error


  Error: dlopen(.../node_modules/sharp/build/Release/sharp.node, 1): Library not loaded: @rpath/libvips-cpp.dylib
    Referenced from: .../node_modules/sharp/build/Release/sharp.node
    Reason: image not found

That error looks very similar to one of the errors in the first post of this issue.

@osartun
Copy link
Contributor

osartun commented Nov 26, 2018

FYI #2: It seems like this issue helped solving it lovell/sharp#939
I ran

$ brew install vips --with-webp --with-graphicsmagick
$ rm -rf node_modules
$ yarn install

When starting the gatsby development server afterwards I didn't get these error messages. However, I got other ones:

…
success source and transform nodes — 101.424 s
error Cannot read property 'internal' of null


  TypeError: Cannot read property 'internal' of null

  - infer-graphql-input-fields.js:346 _.each
    [publizist-frontend-gatsby]/[gatsby]/dist/schema/infer-graphql-input-fields.js:346:38
  …

dist/schema/infer-graphql-input-fields.js:346:38 maps to this code here:

// Get from cache if found, else store into it
if (linkedNodeCache[linkedNode.internal.type]) {
value = linkedNodeCache[linkedNode.internal.type]
} else {

Cannot read property 'internal' of null means that for whatever reason there seem to be null nodes in the .cache.

@lovell
Copy link
Contributor

lovell commented Nov 26, 2018

@osartun The vips brew package doesn't have to be installed for sharp to work on OS X (but if present it will be used). Based on the error here I suspect something went wrong during npm install, perhaps a temporary networking problem.

@osartun
Copy link
Contributor

osartun commented Nov 27, 2018

@lovell Hm, good to know. And also weird. I've deleted and reinstalled all packages of the project multiple times as there were errors every now and then that could be solved by just reinstalling all packages. And yet I'm pretty sure I've got this Library not loaded … error every time I didn't delete the cache before starting up the development server. And I don't think there was a network problem every time I reinstalled the packages.
Might be more complex than I think. Maybe the reason this error didn't show up after installing vips with brew was related to reinstalling the npm packages and not to vips being present.

For the project at hand I'm probably going with some workaround for now. I hope at some point I have time to investigate the issue to figure out what the cause is.

@phetw
Copy link

phetw commented Dec 5, 2018

I did encounter the similar error with v 2.0.60.

    Referenced from: .../node_modules/sharp/build/Release/sharp.node
    Reason: image not found

fixed just by removing .cache and node_modules then reinstall.

@aamorozov
Copy link

Looks like this errors still occurs in the latest version of gatsby/gatsby-plugin-sharp:

  System:
    OS: macOS 10.14
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 11.3.0 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 64.0
    Safari: 12.0
  npmPackages:
    gatsby: 2.0.63 => 2.0.63
    gatsby-image: 2.0.22 => 2.0.22
    gatsby-plugin-favicon: 3.1.4 => 3.1.4
    gatsby-plugin-flow: 1.0.2 => 1.0.2
    gatsby-plugin-force-trailing-slashes: 1.0.4 => 1.0.4
    gatsby-plugin-jsxstyle: 0.0.4 => 0.0.4
    gatsby-plugin-manifest: 2.0.11 => 2.0.11
    gatsby-plugin-offline: 2.0.18 => 2.0.18
    gatsby-plugin-react-helmet: 3.0.4 => 3.0.4
    gatsby-plugin-sharp: 2.0.14 => 2.0.14
    gatsby-source-filesystem: 2.0.12 => 2.0.12
    gatsby-source-graphql: 2.0.7 => 2.0.7
    gatsby-transformer-json: 2.1.6 => 2.1.6
    gatsby-transformer-sharp: 2.1.9 => 2.1.9
  npmGlobalPackages:
    gatsby-cli: 2.4.6
    gatsby: 1.9.277

@daydream05
Copy link
Contributor

daydream05 commented Dec 31, 2018

I'm also running into the same issue when deploying to netlify.

System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.0.0 - /usr/local/bin/node
    Yarn: 1.6.0 - ~/.yarn/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 64.0
    Safari: 12.0.2
  npmPackages:
    gatsby: next => 2.0.0-rc.28
    gatsby-image: next => 2.0.0-rc.4
    gatsby-plugin-canonical-urls: next => 2.0.0-rc.2
    gatsby-plugin-feed: next => 2.0.0-rc.2
    gatsby-plugin-google-analytics: next => 2.0.0-rc.2
    gatsby-plugin-manifest: next => 2.0.2-rc.1
    gatsby-plugin-netlify: next => 2.0.0-rc.6
    gatsby-plugin-nprogress: next => 2.0.0-rc.1
    gatsby-plugin-offline: next => 2.0.0-rc.9
    gatsby-plugin-react-helmet: next => 3.0.0-rc.1
    gatsby-plugin-sitemap: next => 2.0.0-rc.2
    gatsby-plugin-styled-components: next => 3.0.0-rc.5
    gatsby-plugin-svgr: next => 2.0.0-alpha
    gatsby-plugin-typography: next => 2.2.0-rc.3
    gatsby-remark-external-links: 0.0.4 => 0.0.4
    gatsby-remark-prismjs: next => 3.0.0-rc.2
    gatsby-source-contentful: next => 2.0.1-rc.9
    gatsby-source-filesystem: next => 2.0.1-rc.6
    gatsby-transformer-remark: next => 2.1.1-rc.5
    gatsby-transformer-sharp: next => 2.1.1-rc.3
  npmGlobalPackages:
    gatsby-cli: 2.4.5

UPDATE:
I just updated the gatsby-plugin-manifest- to 2.0.13 and it works

@philohelp
Copy link

I'm having an error in the netlify build too, Sharp seems involved.

9:25:21 PM: Executing user command: gatsby build
9:25:24 PM: success open and validate gatsby-configs — 0.179 s
9:25:25 PM: success load plugins — 0.339 s
9:25:25 PM: error Plugin gatsby-transformer-sharp returned an error
9:25:25 PM:
9:25:25 PM: Error: Could not locate the bindings file. Tried:
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/s harp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/D ebug/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/R elease/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/out/Deb ug/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/Debug/s harp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/out/Rel ease/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/Release /sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/d efault/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/compile d/8.15.0/linux/x64/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/addon-b uild/release/install-root/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/addon-b uild/debug/install-root/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/addon-b uild/default/install-root/sharp.node
9:25:25 PM: → /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/bin ding/node-v57-linux-x64/sharp.node
9:25:25 PM:
9:25:25 PM: - bindings.js:124 bindings
9:25:25 PM: [repo]/[bindings]/bindings.js:124:9
9:25:25 PM:
9:25:25 PM: - constructor.js:10 Object.
9:25:25 PM: [repo]/[gatsby-plugin-sharp]/[sharp]/lib/constructor.js:10:34
9:25:25 PM:
9:25:25 PM: - v8-compile-cache.js:178 Module._compile
9:25:26 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
9:25:25 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:178:30
9:25:25 PM:
9:25:25 PM: - v8-compile-cache.js:159 require
9:25:25 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
9:25:25 PM:
9:25:26 PM: Shutting down logging, 25 messages pending

@acollien
Copy link

Me too! Started happening after I tried with a new theme. Switched back and now it's fail-city.

Logs here: https://pastebin.com/7rZ2nH7C

@Blumed
Copy link

Blumed commented Apr 27, 2019

Just had this issue happen to me. Interesting enough I was working in another directory with an older version of gatsby blog starter but I want to start fresh. So, I downloaded a fresh copy and ran into the error above. I was forced to downgrade my node version. Current stable node version is: 12.0.0. This version creates the head ache seen above. node v11.14.0 worked for me and it worked perfectly. Didn't have to add dependancies separately it just worked. Hope this helps someone :)

@GainorB
Copy link

GainorB commented May 1, 2019

Any update here? This is a headache.. Why was this closed? What is the solution?

@prasanna-munnangi
Copy link

this isn't working. can some mention the specific package version of gatsby's which worked.

@nok91
Copy link

nok91 commented Aug 27, 2019

Fixed by updating gatsby-plugin-manifest:

..
 "gatsby-plugin-manifest": "^2.2.9",
...

@anubhavsrivastava
Copy link
Contributor

Read the entire thread, couldn't get anything. This problem has started to show again with netlify and travis CI builds.

@jpcmf
Copy link

jpcmf commented Aug 27, 2019

Deploy to Netlify still not work...

5:37:56 PM: success write out redirect data — 0.021
5:37:56 PM: node: symbol lookup error: /opt/build/repo/node_modules/sharp/build/Release/sharp.node: undefined symbol: _ZNK4vips6VImage7pngsaveEPKcPNS_7VOptionE
5:37:56 PM: npm
5:37:56 PM:  ERR! file sh

@nok91
Copy link

nok91 commented Aug 28, 2019

Wrap with Provider
Create a new file at the root of your project named wrap-with-provider.js. This file will be imported in our gatsby-browser and gatsby-ssr and wrapped around our entire application allowing any component to access our store.

import React from 'react';
import { Provider } from 'react-redux';
import createStore from './src/state/createStore';

export default ({ element }) => (
  <Provider store={createStore()}>
      {element}
  </Provider>
);

Gatsby SSR and Browser
Gatsby SSR and Browser files will be identical. Create a gatsby-ssr.js and gatsby-browser.js file at the root of your projects directory.

import wrapWithProvider from "./wrap-with-provider"
export const wrapRootElement = wrapWithProvider

This works for me on develop and building env

iammatthias referenced this issue in iammatthias/com Aug 30, 2019
@sayjeyhi
Copy link

I have same problem ...

gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.3
gyp info using node@10.16.1 | darwin | x64
gyp info find Python using Python version 2.7.10 found at "/usr/bin/python"
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/macbook/.nvm/versions/node/v10.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/macbook/Desktop/gatsby-blog/node_modules/sharp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/macbook/.nvm/versions/node/v10.16.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/macbook/Library/Caches/node-gyp/10.16.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/macbook/Library/Caches/node-gyp/10.16.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/macbook/.nvm/versions/node/v10.16.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/macbook/Library/Caches/node-gyp/10.16.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/macbook/Desktop/gatsby-blog/node_modules/sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:20:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/mutex:191:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__mutex_base:17:
/Library/Developer/CommandLineTools/usr/include/c++/v1/__threading_support:27:11: fatal error: 'pthread.h' file not found
# include <pthread.h>
          ^~~~~~~~~~~
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/macbook/.nvm/versions/node/v10.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:196: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 18.7.0
gyp ERR! command "/Users/macbook/.nvm/versions/node/v10.16.1/bin/node" "/Users/macbook/.nvm/versions/node/v10.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/macbook/Desktop/gatsby-blog/node_modules/sharp

@TepyThai
Copy link

I was having this problem regarding gatsby-plugin-sharp and the problem got resolved by upgrading my dependencies. I hope it helps.

@zilahir
Copy link
Contributor

zilahir commented Oct 16, 2019

for me this problem caused by changing node version globally.

rm -rf node_modules, then

npm i

helped.

@lxynox
Copy link

lxynox commented Oct 16, 2019

for me this problem caused by changing node version globally.

rm -rf node_modules, then

npm i

helped.

@zilahir can you share your node/npm version? eg npm -v && node -v

@zilahir
Copy link
Contributor

zilahir commented Oct 16, 2019

@lxynox sure.

➜  ~ npm --version
6.10.2

@terwer
Copy link

terwer commented Mar 8, 2022

@bvaughn not sure if it helps, but I ran into issues with yarn after upgrading to node 8 and npm 5.

It seems that node-gyp was bundled with node 7 but not with node 8.

Doing npm install -g node-gyp resolved the issues for me.

Here's the yarn issue: yarnpkg/yarn#3728

Thanks,it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests