The issue involves a build failure with unclear tooling behavior.
The issue involves a build failure when using `pnpx next build` in a Next.js project, while `pnpm build` works. The problem seems related to tooling inconsistencies between `pnpx` and `pnpm`, but the exact cause is unclear. Further investigation into the tooling behavior is needed.
https://github.com/bnjmnjrk/next-build-bug
I expected the build to be successful, but instead I got:
▲ Next.js 16.1.1 (Turbopack)
Creating an optimized production build ... ✓ Compiled successfully in 1622.4ms ✓ Finished TypeScript in 1291.8ms ✓ Collecting page data using 7 workers in 344.7ms Error occurred prerendering page "/global-error". Read more: https://nextjs.org/docs/messages/prerender-error Error [InvariantError]: Invariant: Expected workUnitAsyncStorage to have a store. This is a bug in Next.js. at M (.next/server/chunks/ssr/[root-of-the-server]__03cd63cf..js:1:95629) at bM (.next/server/chunks/ssr/[root-of-the-server]__03cd63cf._.js:4:7728) Export encountered an error on /_global-error/page: /_global-error, exiting the build. ⨯ Next.js build worker exited with code: 1 and signal: null
os: arch-linux
node: v24.4.1
pnpm: 10.26.1
create-next-app
next build (local)
project setup was: pnpm create next-app@latest my-app --yes
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!