Closed justindjeumenet closed 1 month ago
The same build is successful with the command "next build" and starts successfully but NOT with : "deploy": "cloudflare && wrangler deploy", "preview": "cloudflare && wrangler dev",
Hey @justindjeumenet check this out. https://opennext.js.org/cloudflare/troubleshooting#my-app-fails-to-build-when-i-import-a-specific-npm-package
TLDR: Set the below envs when building and starting your server.
WRANGLER_BUILD_CONDITIONS=""
WRANGLER_BUILD_PLATFORM="node"
omg!! @imumesh18 you saved me. Thank you. It works fine. I am going to close this issue.
Hey guys!
next.js version: 14.2.5 wrangler version: 3.80.0
I was able to build successfully but the application cannot start and here is the error:
inlineEvalManifest
patchCached
Worker saved in
/Users/justindjeumene/WebstormProjects/cloudflare-invoices-center/.worker-next/index.mjs
🚀⛅️ wrangler 3.80.0 (update available 3.80.1)
Your worker has access to the following bindings:
KV Namespaces:
.worker-next/.next/standalone/node_modules/@react-pdf/font/lib/index.cjs:7:22: 7 │ var fontkit = require('fontkit'); ╵
~~~~~The module "./dist/browser.cjs" was not found on the file system:
.worker-next/.next/standalone/node_modules/fontkit/package.json:37:15: 37 │ "require": "./dist/browser.cjs" ╵
~~~~You can mark the path "fontkit" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
✘ [ERROR] Could not resolve "yoga-layout"
The module "./src/entrypoint/wasm-async-web.js" was not found on the file system:
You can mark the path "yoga-layout" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
✘ [ERROR] Could not resolve "fontkit"
The module "./dist/browser.cjs" was not found on the file system:
You can mark the path "fontkit" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
✘ [ERROR] Could not resolve "uuid"
The module "./dist/commonjs-browser/index.js" was not found on the file system:
✘ [ERROR] Failed to build
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │ [b] open a browser, [d] open devtools, [l] turn off local mode, [c] clear console, [x] to exit │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ? Would you like to report this error to Cloudflare? › (Y/n)
Any idea guys? I tried to fix it myself but need to dig in your code to understand this situation. Thanks Justin