How to update my gatsby and its dependences

Viewed 4064

I'm new on React and I'm trying to update my gatsby and its dependences but is not working. On the terminal I have put npm outdated and I got this below.

Package                    Current   Wanted  Latest  Location                                Depended by
gatsby                      2.32.4   2.32.9   3.0.0  node_modules/gatsby                     form-gatsby
gatsby-plugin-sass           3.2.0    3.2.0   4.0.0  node_modules/gatsby-plugin-sass         form-gatsby
gatsby-source-filesystem    2.11.1   2.11.1   3.0.0  node_modules/gatsby-source-filesystem   form-gatsby
gatsby-transformer-remark   2.16.1   2.16.1   3.0.0  node_modules/gatsby-transformer-remark  form-gatsby
react                      16.13.1  16.14.0  17.0.1  node_modules/react                      form-gatsby
react-dom                  16.13.1  16.14.0  17.0.1  node_modules/react-dom                  form-gatsby

When I tryind to run this: npm update I got this error below.

npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql@15.5.0
npm WARN node_modules/graphql
npm WARN   graphql@"^15.4.0" from gatsby@3.0.0
npm WARN   node_modules/gatsby
npm WARN     gatsby@"3.0.0" from the root project
npm WARN     6 more (gatsby-plugin-image, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^14.4.1" from express-graphql@0.9.0
npm WARN node_modules/express-graphql
npm WARN   express-graphql@"^0.9.0" from gatsby@3.0.0
npm WARN   node_modules/gatsby
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: gatsby@3.0.0
npm ERR! node_modules/gatsby
npm ERR!   gatsby@"3.0.0" from the root project
npm ERR!   peer gatsby@"^3.0.0-next.0" from gatsby-plugin-image@1.0.0
npm ERR!   node_modules/gatsby-plugin-image
npm ERR!     gatsby-plugin-image@"^1.0.0" from gatsby-source-contentful@5.0.0
npm ERR!     node_modules/gatsby-source-contentful
npm ERR!       gatsby-source-contentful@"^5.0.0" from the root project
npm ERR!   5 more (babel-plugin-remove-graphql-queries, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby@"^2.0.0" from gatsby-plugin-sass@3.2.0
npm ERR! node_modules/gatsby-plugin-sass
user@Users-MacBook-Pro form-gatsby % npm update
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: gatsby-starter-hello-world@0.1.0
npm ERR! Found: gatsby@2.32.9
npm ERR! node_modules/gatsby
npm ERR!   gatsby@"^2.26.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby@"^3.0.0-next.0" from gatsby-plugin-sharp@3.0.0
npm ERR! node_modules/gatsby-plugin-sharp
npm ERR!   gatsby-plugin-sharp@"^3.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/user/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2021-03-02T23_15_17_390Z-debug.log

I have tried to run npm install --force gatsby@3.0.0, but the same didn't work.

Do you guys any way I can update this?

Thanks so much.

3 Answers

Try to run npm install gatsby@latest And only after that run npm outdated

It means the version you are trying to update to has been found

npm ERR!   gatsby@"3.0.0" from the root project

Run gatsby -v to see if version is up to date

For me simply

yarn upgrade

worked.

Related