I recently faced this error while working with gatsby and couldn’t find anything substantial as a result so here are a list of things you can do to solve it -
Clean you global Gatsby sites folder to rebuild
1rm -rf ~/.config/gatsby/sites
or on Windows delete this folder :-
Clean Gatsby Cache
Run ps aux to see if gatsby is still running on any port
1ps aux | grep gatsby
If you see any result kill those processses and try
gatsby develop again.
What worked for me after updating
gatsby-cli and gatsby, was to initialize new test project with
gatsby new your-project-name somewhere else (just to test if the new starter would work).
Run gatsby develop, it should start the dev server, open it on
cmd/ctrl+c to close it and you can delete that test project.
Now go back to your project that didn’t work and try
gatsby develop, everything should work now.