If you're having build trouble with Gatsby a lot of times clearing your
.cache and public folders will fix the problem. There's even a Gatsby CLI shortcut to help with that.
If you're still having trouble, try removing the
node_modules folder and reinstalling npm packages.
Also make sure you're not mixing yarn and npm for managing your Gatsby project. It can quickly get messy.