cloudflare / next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages
https://www.npmjs.com/package/@cloudflare/next-on-pages
MIT License
1.27k stars 121 forks source link

[🐛 Bug]: Error: `vercel build` must not recursively invoke itself. #835

Open magick93 opened 2 months ago

magick93 commented 2 months ago

next-on-pages environment related information

Running npx @cloudflare/next-on-pages --info results in:

npm ERR! Cannot set properties of null (setting 'peer')

Description

When I run pnpm exec next-on-pages I get the following:

⚡️ @cloudflare/next-on-pages CLI v.1.12.1
⚡️ Detected Package Manager: pnpm (9.5.0)
⚡️ Preparing project...
⚡️ Project is ready
⚡️ Building project...
▲  Vercel CLI 35.1.0
▲  Detected `pnpm-lock.yaml` version 9 generated by pnpm 9
▲  WARNING: You should not upload the `.next` directory.
▲  Installing dependencies...
▲  Scope: all 46 workspace projects
▲  ../..                                    | Progress: resolved 1, reused 0, downloaded 0, added 0
▲  ../..                                    |    +2549 ++++++++++++++++++++++++++++
▲  ../..                                    | Progress: resolved 2549, reused 351, downloaded 0, added 0
▲  ../..                                    | Progress: resolved 2549, reused 1043, downloaded 0, added 0
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 116
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 1302
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 1618
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 1780
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 2039
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 2095
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 2547
▲  ../..                                    | Progress: resolved 2549, reused 2521, downloaded 0, added 2549, done
▲  
▲  ../.. prepare$ husky install
▲  ../.. prepare: husky - Git hooks installed
▲  ../.. prepare: Done
▲  Done in 23.1s
▲  Detected Next.js version: 14.1.0
▲  Running "pnpm run build"
▲  > builder@0.1.0 build /home/anton/git/yestech/typebot.io/apps/builder
▲  > dotenv -e ./.env -e ../../.env -- pnpm exec next-on-pages
▲  ⚡️ @cloudflare/next-on-pages CLI v.1.12.1
▲  ⚡️ Detected Package Manager: pnpm (9.5.0)
▲  ⚡️ Preparing project...
▲  ⚡️ Project is ready
▲  ⚡️ Building project...
▲  ▲  Vercel CLI 35.1.0
▲  ▲  Error: `vercel build` must not recursively invoke itself. Check the Build Command in the Project Settings or the `build` script in `package.json`
▲  ▲  Error: Learn More: https://vercel.link/recursive-invocation-of-commands
▲  ⚡️ The Vercel build (`pnpm dlx vercel build`) command failed. For more details see the Vercel logs above.
▲  ⚡️ If you need help solving the issue, refer to the Vercel or Next.js documentation or their repositories.
▲  ELIFECYCLE  Command failed with exit code 1.
▲  Error: Command "pnpm run build" exited with 1

⚡️ The Vercel build (`pnpm dlx vercel build`) command failed. For more details see the Vercel logs above.
⚡️ If you need help solving the issue, refer to the Vercel or Next.js documentation or their repositories.

Reproduction

I'm working on getting this for you

Pages Deployment Method

None

Pages Deployment ID

No response

Additional Information

I was trying to deploy using wrangler.

Would you like to help?

bsgrigorov commented 2 months ago

I am facing the same issue. I tried different commands for running it and it always ends in recursion.

oustn commented 1 month ago

Check if you change the build script to "next-on-pages". You shouldn't change the default build script. The script exec chain: npx next-on-pages -> vercel build -> npm run build -> next build. If you change the build script to next-on-pages, the chain will be npx next-on-pages -> vercel build -> npm run build -> next-on-pages -> vercel build. This makes error