Are your Vercel builds failing when you're trying to use got by Sindre Sorhus with Next.js 13 or 14?

1error [email protected]: The engine "node" is incompatible with this module. Expected version ">=20". Got "18.18.2"
2error Found incompatible module.
3
4error TS2307: Cannot find module 'got' or its corresponding type declarations.
5
6import * as got from 'got'
7 ~~~~~

Maybe you've stumbled upon this GitHub issue and looked for a solution but got confused with people's answers.

sindresorhus/got🌐 Human-friendly and powerful HTTP request library for Node.js - sindresorhus/gotgithub.com/sindresorhus/got/issues/2267

The fix is pretty simple.

  • Go to your project settings on Vercel
  • Scroll down to the Node.js Version section and select 20.x
  • Add a got.d.ts file to your project's root.
got.d.ts
1declare module "got" {
2 import * as got from "got/dist/source";
3 export = got;
4}

That should do the trick. Your Vercel builds will work again.

get notified when i write something new or launch a new project right into your inbox.

or

subscribe on telegram

Thanks for your time & attention.