-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Comments
Just did [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 |
FYI I tried a couple of clean installs of |
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. |
@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 Here's the yarn issue: yarnpkg/yarn#3728 |
Thanks for the tip @jharris4! Unfortunately I've tried downgrading to Node 7 (via NVM) and globally installing 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 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. |
Of course! I didn't mean to sound complainy. (Hopefully I didn't!) 😄 Was just thinking out loud. |
This morning 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 FWIW I've tried this on Node 7.9.0, 8.2.0, and 8.4.0. |
🤣 I left it running and stepped away from my computer. When I returned:
|
You hit node's heap limit. Try raising that. |
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 |
Nope. I'll look into it soon. |
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 |
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. |
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: Turns out that things went bad with this recent commit: 6a55b33. The commit before it (b6fb888) works fine, assuming I first install The reason I saw the same hanging behavior toward the end of my initial issue was b'c I also ran So one of the bumped dependencies seems to have caused this new permanently-hanging behavior. I'll try to step through individual plugins next. |
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 |
See the following blockers for the modules I didn't update: * gatsbyjs/gatsby#1844 * gatsbyjs/gatsby#1754
Narrowed it down further to |
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. |
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. |
If you beat me to it, I'd be grateful for any notes you left here about your findings :) |
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). |
You're doing this via the "Build environment variables"? |
Yeah. BTW, does it build locally? Or are you having troubles there too? |
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. |
Which Yarn version are you pinned to btw |
FWIW (might be unrelated) I also had a project using Yarn 0.27.5 in
After that things built fine again on Netlify without having to manually purge the cache. |
sharp 0.20.0 is now released, do you have an ETA on the plugin using the updated version? thanks |
@devdigital It should be fairly soon, see #4365 |
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.
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 This is the error I'm getting multiple times when starting the gatsby development server without clearing the cache beforehand:
That error looks very similar to one of the errors in the first post of this issue. |
FYI #2: It seems like this issue helped solving it lovell/sharp#939 $ 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:
gatsby/packages/gatsby/src/schema/infer-graphql-input-fields.js Lines 283 to 286 in b5b43d5
|
@osartun The |
@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 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. |
I did encounter the similar error with v
fixed just by removing .cache and node_modules then reinstall. |
Looks like this errors still occurs in the latest version of gatsby/gatsby-plugin-sharp:
|
I'm also running into the same issue when deploying to netlify.
UPDATE: |
I'm having an error in the netlify build too, Sharp seems involved. 9:25:21 PM: Executing user command: gatsby build |
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 |
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 :) |
Any update here? This is a headache.. Why was this closed? What is the solution? |
this isn't working. can some mention the specific package version of gatsby's which worked. |
Fixed by updating gatsby-plugin-manifest:
|
Read the entire thread, couldn't get anything. This problem has started to show again with netlify and travis CI builds. |
Deploy to Netlify still not work...
|
Wrap with Provider
Gatsby SSR and Browser
This works for me on develop and building env |
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
|
I was having this problem regarding |
for me this problem caused by changing
helped. |
@zilahir can you share your node/npm version? eg |
@lxynox sure.
|
Thanks,it worked. |
I've ran into a problem after doing a clean install of this project.
npm run dev
failed with: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-rannpm run dev
. This time it failed with: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: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.
The text was updated successfully, but these errors were encountered: