Error: Cannot find module "react" in Gatsby
There was a problem loading the local develop command. Gatsby may not be installed. Perhaps you need to run “npm install”? Cannot find module ‘react’
This issue occured after I added a new plugin to handle gatsby redirects.
The issue appears because of conflicting versions of React and npm unable to reconcile them individually.
For most people, the solution was to clean out all node_modules and reinstall:
rm -Rf node_modules package-lock.json npm install
If you still experience issues after trying the above, try swapping to yarn.
rm -Rf node_modules package-lock.json yarn install
Incidentally, Azure Static Web Apps uses yarn, so I swapped over permanently for this project.