opennextjs-cloudflare: Error when building
Hi, thank you for working on this.
I can’t build my app. This is my wrangler.toml:
name = "project"
main = ".worker-next/index.mjs"
compatibility_date = "2024-08-29"
compatibility_flags = ["nodejs_compat_v2"]
assets = { directory = ".worker-next/assets", binding = "ASSETS" }
This is what I get after running the command "build:worker": "cloudflare" (the project is built and I get to see the summary of the routes in the terminal)
○ (Static) prerendered as static content
ƒ (Dynamic) server-rendered on demand
⚙️ Copying files...
# copyPackageTemplateFiles
⚙️ Bundling the worker file...
# patchWranglerDeps
node:fs:448
return binding.readFileUtf8(path, stringToFlags(options.flag));
^
Error: ENOENT: no such file or directory, open
'project/apps/web/.worker-next/.next/standalone/apps/web/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js'
Node.js v22.0.0
As expected, there is no file under that directory
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 20 (6 by maintainers)
@seivad @jsmestad @VojGin
In my case this was caused by an old version of esbuild being installed in our monorepo. Adding
To the Next.js package
package.jsonfixed itThe fix is on its way! 😄
@blakeembrey thanks so much! with that I could reproduce the issue! 😄
I’ve also found the solution, I’ve got to work on something unrelated for a bit, I’ll open a PR with the fix later today 🙂👍
I get the same error as above after converting a project from next-on-pages to opennext, is there any solution?
@dario-piotrowicz just to let you know that the build is working on my side using yarn. Thanks for the fix
Thank you a lot, next time I will add a repro for sure!
I’m getting the same error even with the
@cloudflare/next-on-pagespackage removed.I’m on
next@14.2.16and@opennextjs/cloudflare@0.2.1@fprl it could be fixed now, if you want please try the latest release
0.0.0-acc0c5eand let me know if it’s all good now 🙂