Issue: Nuxt Bridge fails to run or build, error with unenv mock proxy
When trying to run a Nuxt 2 application with nuxt-bridge on, I get the following error:
So it can't find the
proxy.mjs
but is looking in dist/runtime/runtime/mock/proxy.mjs
when in fact the file is in dist/runtime/mock/proxy.mjs
Minimal repro here: https://github.com/nicodevs/bridging
Any ideaon how to solve it?GitHub
GitHub - nicodevs/bridging: Attempt to bridge a Nuxt 2 app
Attempt to bridge a Nuxt 2 app. Contribute to nicodevs/bridging development by creating an account on GitHub.
2 Replies
Hi @NicoDevs. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources, I can see that your issue with Nuxt Bridge is related to recent changes in the
unenv
package and its integration with Nitro.
The error you're experiencing appears to be related to path resolution issues with the unenv
package, specifically with the mock proxy module. This is similar to issues that have been reported in Nuxt 3 after upgrading to newer versions.
From the knowledge sources, I can see that:
1. There have been significant changes to unenv
with the upgrade to version 2, which has caused compatibility issues with Nitro and Nuxt as mentioned in this PR.
2. There are known issues with hoisting on unenv
that have been addressed in newer versions of Nuxt with a new mocked-exports
approach as noted in this PR.
3. Similar errors have been reported by users after upgrading to Nuxt 3.16.0, related to unenv
dependencies as discussed in this issue.
To solve this issue, you could try:
1. Manually adding unenv
as a dev dependency:
or
2. Clean your project's dependencies and reinstall:
3. Make sure you're using compatible versions of Nuxt Bridge and Nitro. The knowledge sources indicate that Nuxt Bridge requires specific configurations for Nitro to work properly as documented here.
4. Check your nuxt.config.ts
to ensure you have properly configured Bridge with Nitro:
It's worth noting that Nuxt Bridge support is being phased out in newer versions of Nuxt, as indicated by this PR which removes support for Nuxt 2/Bridge in newer versions.
If these solutions don't work, you might need to consider migrating to Nuxt 3 as Bridge is a transitional solution and may have compatibility issues with the latest dependencies.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@547731342251655169> Kapa.ai is still learning and improving, please let me know how I did by reacting below.