Just wanted to add my experience incase it helps anyone.
I am using a Sanity CMS + Gatsby set up which comprises of a root folder containing a web and a studio directory. I was forgetting to delete the package.lock and node modules folders from all three and was therefore getting conflicting react version errors. So remember to check in all of your project’s directories.
Nathan you are a life saver! This is precisely what was happening with my deploys, and I was wondering why I had to force the npm_flags every time. Turns out its the tailwindcss generated package-lock.json pegged to certain versions as you mentioned. Thanks a ton!