Issues running NextJS installed with "npm create cloudflare@latest"

For Workers & Pages, what is the name of the domain?

N/A

What is the error number?

N/A

What is the error message?

ReferenceError: await is not defined

What is the issue or error you’re encountering

Issues to run NextJS

What steps have you taken to resolve the issue?

N/A

What are the steps to reproduce the issue?

Hi,

I am trying to create a new Next.js app that I will deploy to Cloudflare Pages. I am following the official documentation:

To create the new Next.js app I am using the npm command from Cloudflare in order to have a pre-configured app to run on Cloudflare Pages.
This is the command I used: npm create cloudflare@latest

However when my NodeJS app is ready and I use “npm run dev” it gives errors (ReferenceError: await is not defined).

Are you facing the same issue?

Thank you

Hi, which version of Node.js are you using? (node -v) Using the latest version might solve it since it appears to be related with await

Hi @ares ,

thank you for your reply.

I was using v21.7.3 and since it was not the latest release I also tried with v23.5.0 which is the last one released.

I am facing the same issue. I don’t know how can I fix it.

I am using your command “npm create cloudflare@latest” to create the NextJS project for Cloudflare Pages.

Hope you can help me!

Thank you :slight_smile:

I am still waiting for some help. Unfortunately I didn’t find out how to fix it yet.

Hi! I’m facing the same issues related by @HurryFlower

  • Create a new project with pnpm create cloudflare@latest my-name-app --framework=next
  • Run npm run dev
  • Throw error, await is not defined
    .

I resolve with a work around. Wrapping await into an IIFE