Cannot update from Gatsby 2.12.78 to 3.X globally

Viewed 158

I have tried running npm i -g gatsby-cli and sudo npm i -g gatsby-cli but when I run gatsby --version it still says 2.12.78 even though it also says "Update available 2.12.78 → 3.10.0 | Run npm i -g gatsby-cli to update"

These are my package versions:

npm version: 7.19.1

node version: v16.5.0

Gatsby CLI version: 2.12.78

1 Answers

You just need to follow the migration guide:

npm install gatsby@latest

All gatsby-* should be upgraded too, but without updating the global Gatsby package you can't update the related ones. Check them by:

npm outdated
Related