gatsby: gatsby-plugin-sharp dependency problem?
- 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.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 53 (37 by maintainers)
Commits related to this issue
- Updated all Gatbsy plugins/transforms that can be safely updated See the following blockers for the modules I didn't update: * https://github.com/gatsbyjs/gatsby/pull/1844 * https://github.com/gatsbyj... — committed to bvaughn/react by bvaughn 7 years ago
- Update Gatsby and Gatsby image plugins to fix error. https://github.com/gatsbyjs/gatsby/issues/1754 — committed to coreybruyere/coreybruyere-netlify-cms by coreybruyere 6 years ago
- Update package.json — committed to iammatthias/com by iammatthias 5 years ago
Deploy to Netlify still not work…
@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: https://github.com/yarnpkg/yarn/issues/3728
I’m also running into the same issue when deploying to netlify.
UPDATE: I just updated the
gatsby-plugin-manifest-
to2.0.13
and it worksthis isn’t working. can some mention the specific package version of gatsby’s which worked.
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. 😄Fixed by updating gatsby-plugin-manifest:
Any update here? This is a headache… Why was this closed? What is the solution?
Looks like this errors still occurs in the latest version of gatsby/gatsby-plugin-sharp:
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.
for me this problem caused by changing
node
version globally.rm -rf node_modules
, thennpm i
helped.
I have same problem …
Read the entire thread, couldn’t get anything. This problem has started to show again with netlify and travis CI builds.
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.
I was having this problem regarding
gatsby-plugin-sharp
and the problem got resolved by upgrading my dependencies. I hope it helps.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 😃
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.<anonymous> 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
@devdigital It should be fairly soon, see #4365
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 https://github.com/yarnpkg/yarn/issues/5152#issuecomment-363608999 and editednetlify.toml
accordingly, adding--no-ignore-optional
:After that things built fine again on Netlify without having to manually purge the cache.
Oh my goodness, that would be a nice improvement
Of course! I didn’t mean to sound complainy. (Hopefully I didn’t!) 😄 Was just thinking out loud.
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.