Vercel deployment build failed due to Node version

I recently got a build error message in my terminal when I ran vercel --prod.

Node.js Version "12.x" is discontinued and must be upgraded. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16.

The solution is quite simple. All you need to do is add a property in your package.json file called engines,

Define the Node version the error message is telling you to add.

"engines": {
  "node": "16.x"

I like to tweet about code and post helpful code snippets. Follow me there if you would like some too!