Integrate MongoDB Into Your Next.js App - build error

I’ve just been going through the article " How to Integrate MongoDB Into Your Next.js App". Everything worked OK when I used ‘npm run dev’. But when I got near the end where it says to use ‘npm run build’, it gave this error:

Index.tsx build error

Then I deleted the mflix directory and ran only these commands:

npx create-next-app --example with-mongodb mflix
cd mflix
npm run build

But the same thing happened again.
I’m using Node v17.0.0 on Windows 10.

It works on Ubuntu using Node v16.15.1, as long as I change (context) to (context: any):

export async function getServerSideProps(context: any)

I originally tried that on Windows, but it didn’t work. So maybe it’s a problem with TypeScript on Windows?