Nitro undefined preset/undefined emulation error
Hey
A side project that I'm working on has stopped working after upgrading Nitro to
v2.12
. I'm getting this error when I try to start the dev server:
Possibly relevant is that the line right before the error says:
The project has nitro-cloudflare-dev
installed, not sure if this may have anything to do with it.
I used Cloudflare's instructions (https://developers.cloudflare.com/workers/framework-guides/web-apps/more-web-frameworks/nuxt/) for setting up the project with their development tools preinstalled a few months back. I tried creating a new project to see if the error would repeat, but it didn't.
Any ideas what might be causing this to happen?Cloudflare Docs
Nuxt
Create a Nuxt application and deploy it to Cloudflare Workers with Workers Assets.
7 Replies
Hi @a cockatoo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error message you're seeing—
Nuxt recommends explicitly setting the Nitro preset in your
You mentioned having
There have been updates to how Nitro handles preset directories and configuration in recent versions (see this PR). If your project or dependencies reference old preset paths or expect different behavior, this could cause issues after upgrading. 4. Compare with a Fresh Project:
Since you mentioned that a new project does not have this issue, compare your
The most likely cause is a missing or incorrect Nitro preset in your configuration, or a conflict introduced by the
Nitro entry is missing! Is "undefined" preset correct?
and Using undefined emulation in development mode.
—suggests that Nitro is unable to determine the correct preset for your environment after upgrading to v2.12. This typically happens if the Nitro preset is not explicitly set or if there is a misconfiguration in your nuxt.config.ts
.
Key points and suggestions based on the knowledge sources:
1. Explicitly Set the Nitro Preset:Nuxt recommends explicitly setting the Nitro preset in your
nuxt.config.ts
file, especially when deploying to specific environments like Cloudflare Workers. For example, for Cloudflare Workers, you should use the cloudflare_module
preset and set a compatible compatibilityDate
:
Make sure your preset matches your intended deployment target. If you are not targeting Cloudflare, use the appropriate preset (e.g., node-server
, vercel
, etc.) as described in the Nuxt deployment docs.
2. Check for Outdated or Conflicting Packages:You mentioned having
nitro-cloudflare-dev
installed. The official Nuxt Content documentation for Cloudflare Workers does not mention this package; instead, it relies on the built-in Nitro integration. It's possible that this package is interfering with Nitro's preset detection. Try removing nitro-cloudflare-dev
and rely on the official configuration as shown above.
3. Recent Nitro Changes:There have been updates to how Nitro handles preset directories and configuration in recent versions (see this PR). If your project or dependencies reference old preset paths or expect different behavior, this could cause issues after upgrading. 4. Compare with a Fresh Project:
Since you mentioned that a new project does not have this issue, compare your
nuxt.config.ts
and dependencies with the new project. Look for differences in the Nitro configuration and installed packages.
Summary:The most likely cause is a missing or incorrect Nitro preset in your configuration, or a conflict introduced by the
nitro-cloudflare-dev
package. Update your nuxt.config.ts
to explicitly set the correct preset for your deployment target, and remove any unnecessary or conflicting packages. This should resolve the "undefined preset" and "undefined emulation" errors.
For more details and examples, see the Nuxt Content Cloudflare Workers deployment guide and the Nuxt deployment documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@808175861831434340> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I am not using cloudflare, i got the same error.
I am setting preset to 'github_pages' and it doesnt work. V3 with compatibility version 4 works like a charm, but v4 directly doesnt work.
hmm that's interesting
I tried both upgrading to Nuxt v4 and only upgrading packages while keeping Nuxt in v3.
Both will upgrade Nitro to v2.12 and have the same error.
A question, what package manager are you using?
npm
I've managed to find a fix that worked for my project.
If there aren't any older nuxt/nitro behaviours that your project depends on, you need to set
compatibilityDate
to 2025-07-15
or later in nuxt.config.ts
Perhaps this may solve the issue for you too.Thanks man. It was 05-15 andi didnt update it to 07-15. That caused the problem. Thanks!!