next-on-pages icon indicating copy to clipboard operation
next-on-pages copied to clipboard

[πŸ› Bug]: build error

Open zhugezifang opened this issue 1 year ago β€’ 2 comments

next-on-pages environment related information

No response

Description

it buid is good yesterday, but it is error today, i do nothing of my code

this is the error

14:15:26.583 | β–²  ./src/app/[lang]/layout.tsx:89:14
-- | --
14:15:26.583 | β–²  Type error: 'Navbar' cannot be used as a JSX component.
14:15:26.583 | β–²  Its type '({ lang }: { lang: "zh"; }) => Promise<Element>' is not a valid JSX element type.
14:15:26.583 | β–²    Type '({ lang }: { lang: "zh"; }) => Promise<Element>' is not assignable to type '(props: any, deprecatedLegacyContext?: any) => ReactNode'.
14:15:26.583 | β–²      Type 'Promise<Element>' is not assignable to type 'ReactNode'.
14:15:26.583 | β–²
14:15:26.583 | β–²    87 \|             <div className="absolute inset-0 bg-gradient-radial-t from-primary/20 to-transparent pointer-events-none" />
14:15:26.583 | β–²    88 \|             <div className="absolute inset-0 bg-gradient-radial-b from-primary/20 to-transparent pointer-events-none" />
14:15:26.584 | β–²  > 89 \|             <Navbar lang={lang} />
14:15:26.584 | β–²       \|              ^
14:15:26.584 | β–²    90 \|             <main className="relative flex-1">
14:15:26.584 | β–²    91 \|               <BreadcrumbWrapper lang={lang} dict={dict} />
14:15:26.584 | β–²    92 \|               {children}
14:15:26.630 | β–²  Error: Command "npm run build" exited with 1

Reproduction

No response

Pages Deployment Method

None

Pages Deployment ID

No response

Additional Information

No response

Would you like to help?

  • [ ] Would you like to help fixing this bug?

zhugezifang avatar Dec 06 '24 06:12 zhugezifang

Hi @zhugezifang πŸ™‚ πŸ‘‹

Thank you very much for the issue, unfortunately I did try to create a new application and did not encounter this problem

So I'm afraid that the logs you shared are not enough to understand what's going on here (those logs seem to come from the vercel build command, so it feel like it might even be unrelated to next-on-pages...?)

Could you please provide more details and ideally a minimal reproduction for the issue?

How are you deploying you application? can you run the build and preview the application locally?

Any info here would be very useful πŸ™

dario-piotrowicz avatar Dec 07 '24 16:12 dario-piotrowicz

We had the same issue but i was able to get it to work again.

I think it was because the cf build wasn't using our pnpm lockfile. Please check your npm/pnpm/yarn install logs and see if the correct package manager version is used and that it's installing from lockfile.

e.g. we saw the following while developing with pnpm@9. It said that pnpm 8 will be used and all locked dependencies ignored. I guess then some weird typedef combination got picked.

17:51:58.871 | Preparing [email protected] for immediate activation...
-- | --
17:52:00.515 | ! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha512.41bb77121614697152da4e052d003baf6fde633fc9a03786ebcd3fdd45c6d066b4dcb3ee6381a076f08b7beccedcced99d61b8548e1b03093b4292727ebe5ea8.
17:52:00.516 | ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager
17:52:00.516 | Β 
17:52:00.955 | Installing project dependencies: pnpm install
17:52:01.613 | WARN  Ignoring not compatible lockfile at /opt/buildhome/repo/pnpm-lock.yaml

Adding the packageManager field to our package.json fixed it, e.g.

 "packageManager": "[email protected]+sha256.2ef6e547b0b07d841d605240dce4d635677831148cd30f6d564b8f4f928f73d2",

No idea why it happened now but it prob means that we just were incredibly lucky that the "unlocked" dependencies, that pnpm installed, didn't break anything. Just now some dependency introduced a breaking change from Thursday to Friday which made this noticeable.

Feels a bit weird that it's actually completing the install step without throwing an error if the lockfile can't be used.

makepanic avatar Dec 07 '24 17:12 makepanic

Hello πŸ™‚

Earlier this year we released our Cloudflare adapter for OpenNext, and we have been continuously investing effort in its improvement since then. Existing deployments can continue to use the next-on-pages tooling, but the Cloudflare adapter for OpenNext is currently stable and recommended for deployment of Next.js applications to Cloudflare.

As such, we will no longer be maintaining next-on-pages. We recently deprecated the package on npm and we plan to archive this repo on Monday Sep 29, 2025. In preparation for archival, we are closing all open issues and PRs.

If you have concerns, please feel free to reply here before the repo is archived (after that, it will no longer be possible to comment) or to reach out to our team on Discord.

Thanks so much for using and contributing to next-on-pages 🧑

dario-piotrowicz avatar Sep 26 '25 23:09 dario-piotrowicz