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

Something went wrong installing the "sharp" module #20957

Closed
KamranMaqbool opened this issue Jan 28, 2020 · 10 comments
Closed

Something went wrong installing the "sharp" module #20957

KamranMaqbool opened this issue Jan 28, 2020 · 10 comments

Comments

@KamranMaqbool
Copy link

install gatsby-plugin-sharp plugin but when run command

gatsby develop
then return error

Screenshot from 2020-01-28 23-05-22

@galvogalvo
Copy link

@KamranMaqbool I sometimes see this, especially when moving between different branches that have different dependency versions, sharp seems especially vulnerable to this.

To resolve I do (with yarn):

  • rm -r node_modules/sharp
  • yarn install --check-files

@vladar
Copy link
Contributor

vladar commented Jan 29, 2020

Thank you for opening this, @KamranMaqbool

There are several issues discussing this problem with suggested solutions:

#18277
#17659
#15320

Try those, one of them should fix it for you.

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! 💜

@vladar vladar closed this as completed Jan 29, 2020
@Riya0503
Copy link

Riya0503 commented Jan 5, 2021

TypeError: Cannot read property '_context' of undefined in Gatsby
Gatsby build shows no error but on opening http://localhost:8000/ it's showing this error.

useContext node_modules/react/cjs/react.development.js:1481

  1478 | } // TODO: add a more generic warning for invalid values.  
  1479 |   
  1480 |   
  1481 | if (Context._context !== undefined) {  
  1482 |   var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs  
  1483 |   // and nobody should be using this in existing code.  
  1484 |

@goodpixels
Copy link

I am sorry @vladar, but I don't think this issue should be closed. Clearly many people run into this problem, and all of the "solutions" mentioned in other tickets are just workarounds.

I understand Sharp is an external dependency, but since it's a problem that's been bugging it for a long time and their developers have not fixed it yet, I think it's time to move away from Sharp, or at least make it optional.

I work on three different machines, and each time I want to clone a repository on one of them and work on my project I get this error.

Sharp should be removed or replaced with a better solution.

@belal-mazlom
Copy link

I tried all suggested solutions. it turns out yarn cache was the issue!
These steps fix my issue:

yarn cache clean
rm -rf node_modules
yarn
...

@Frankruiz90
Copy link

Frankruiz90 commented Feb 24, 2022

image

hi, i have this problem

@SergiOca87
Copy link

This error is killing me, spent 2 days trying to fix it and nothing...

@matstlo
Copy link

matstlo commented Mar 1, 2022

This error is killing me, spent 2 days trying to fix it and nothing...

Me too !!! Argggg. Did you solve your problem? How?!

@SergiOca87
Copy link

This error is killing me, spent 2 days trying to fix it and nothing...

Me too !!! Argggg. Did you solve your problem? How?!

Not yet, but I have found out this and while I haven't tried yet, I feel it's close to my problem so it could potentially fix it:

lovell/sharp#3086

I think there is a new version to address the issue.

@matstlo
Copy link

matstlo commented Mar 1, 2022

This error is killing me, spent 2 days trying to fix it and nothing...

Me too !!! Argggg. Did you solve your problem? How?!

Not yet, but I have found out this and while I haven't tried yet, I feel it's close to my problem so it could potentially fix it:

lovell/sharp#3086

I think there is a new version to address the issue.

I solved my problem here ! I really don't know why, but completely uninstalling NodeJs and reinstalling it (checking the box with tools) worked for me. Just updating it is not enough. Good luck !

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

9 participants