editor
Hi All
I've been code very happilly for the whole day now, and even though I've not changed any dependencies, I now get the following error when running
npm run dev:
The browser console shows the following error:
I've done npx nuxi cleanup, and reinstalled node_modules npm install, but the error persists.
These workaround did not help, https://github.com/sindresorhus/globby/issues/260.
Please help!
Here is my nuxt.config.ts:
GitHub
Issues · sindresorhus/globby
User-friendly glob matching. Contribute to sindresorhus/globby development by creating an account on GitHub.
2 Replies
Hi @Nerdnum. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry you're encountering this issue. Based on the error messages:
and
This appears to be a problem with Vite's dependency optimization cache, possibly related to a broken or incompatible dependency export in your
Troubleshooting ESM Issues What you can try: 1. Explicitly include problematic dependencies in Vite's optimizeDeps: 2. Transpile or alias the problematic library: 3. Clear Vite's cache manually:
Delete the
node_modules (specifically unicorn-magic as used by globby). The 504 errors for Pinia and VueUse also suggest Vite's optimized dependency cache is out of sync or corrupted.
What you've already tried:
- npx nuxi cleanup
- Reinstalling node_modules with npm install
- Workarounds from the globby issue tracker
Relevant information from the knowledge sources:
- There are known issues in Nuxt 3 and Vite where dependency optimization can break, causing full page reloads or errors if dependencies are not properly optimized or exports are missing. Sometimes, dependencies need to be explicitly included in Vite's optimizeDeps.include option in your Nuxt config to avoid repeated optimization or cache issues. This is especially true for packages that are not ESM-friendly or have unusual export structures. See the suggestion here:"try passing the dependencies that cause the reloads to vite's optimizeDeps include ... in your nuxt config"Optimizing dependencies - Nuxt 3.8.1 - If you encounter ESM/CJS interop issues, you may need to alias or transpile problematic libraries in your Nuxt config.
Troubleshooting ESM Issues What you can try: 1. Explicitly include problematic dependencies in Vite's optimizeDeps: 2. Transpile or alias the problematic library: 3. Clear Vite's cache manually:
Delete the
.nuxt, node_modules/.cache, and node_modules folders, then reinstall:
If these steps do not resolve the issue, it's possible that a recent update to one of your dependencies (even a transitive one) introduced a breaking change. In that case, you may need to pin versions or investigate recent changes in the unicorn-magic or globby packages.
If the problem persists, please provide more details about your dependency versions or consider creating a minimal reproduction for further debugging.
Let me know if you need more help!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@870575513763217440> Kapa.ai is still learning and improving, please let me know how I did by reacting below.