nuxt: Error: "defuFn is not a function" in 3.0.0-rc.9-xx
Environment
- Operating System:
MacOS - Node Version:
v16.17.0 - Nuxt Version:
3.0.0-rc.9-27702110.abd5dc5 - Package Manager:
npm@8.15.0 - Bundler:
Vite - User Config:
- - Runtime Modules:
- - Build Modules:
-
Reproduction
package.json
"dependencies": {
"@headlessui/vue": "^1.6.7",
"@heroicons/vue": "^1.0.6",
"nuxt": "npm:nuxt3@^3.0.0-rc.9-27702110.abd5dc5",
"pinia": "^2.0.21",
"primeicons": "^5.0.0",
"primevue": "^3.15.0",
"vue": "^3.2.37"
}
Describe the bug
When trying to fix loading problem of resources (ex: js files…) to follow cdnURL path with the version 3.0.0-rc.9-27702110.abd5dc5, and the resources loading problem was solved perfectly, thank you!
But there was an error with:
__vite_ssr_import_0__.defuFn is not a function
Temp Solution:
I solved it with adding defu dependencies "defu": "^6.1.0" in package.json for now.
npm i defu
Has anyone run into the same problem? Or other solutions? Thank you!
Additional context
No response
Logs
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 47 (6 by maintainers)
just write ssr: false in nuxt.config.ts
check if you have any node_module in your home directory. for ex. if you are on windows goto c/Users/<you username> and check for node_module folder. if theres on rename or delete it. this works for me. source
the problem still exists for me, even after updating to rc10 and installing defu
Same thing here. I understand you’re asking for a reproduction, but it’s a big project and evrything created from scratch would not reflect it. My project worked with rc8, and I have this error message with rc9 when doing npm run dev. Could you at least explain the meaning of the error message to do our own research if you don’t want to help without reproduction ? Thanks
Just change your nuxtjs version to 3.0.0-rc.8 in package.json to downgrade. And don’t forget to run
npm installsame here no clear answer, im going to try wait until rc.11 to see if they fix it
I’ve been following this thread for 3-4 days now and each day I’ve had the same issue. TODAY(9/15/22) I try it and everything worked.
I had the same issue. Nuxt 3 RC 10, I just removed @nuxtjs/axios and installed Defu. Now it works like a charm.
It can be reproduced that way 👏🏻
@joseph-montanez But why is
@nuxtjs/axiosincluded? It is a Nuxt2 module 🤔When removing it from
package.jsonand recreate lockfile, things work accordingly 👍🏻Same issue.
On Mac (Intel),
Happened just after I made a npm -g upgrade, then created a brand new with npx nuxi init -t doc-driven ui. I’m using brew too, it caused issues in the past with npm global package (maybe a track).
Kind of “good” news : after many tries on my project, I just launched a new empty project with nuxi init and the problem appears the same way ! @danielroe So is it something more hardware or os related ? @lucassimines on which Os are you ?
nuxi version : Nuxi 3.0.0-rc.9 node version v16.13.1 npm version 8.19.1 MacBook Air / Apple M1 / 8Go on Monterey 12.4
I’m experiencing the same issue and trying to find the error to create a reproduction. But installing
defufor now solved the issue.Just tried edge channel https://v3.nuxtjs.org/getting-started/upgrade-guide/edge-channel/ and no problems in Nuxt 3.0.0-rc.11-27727864.720da64 with Nitro 0.5.4-27726613.640c2b7
I’ve provided a Github Repo that produces the issue 100% of the time:
https://github.com/joseph-montanez/nuxt-framework-issue-7168
npm i npm run dev
Installing Nuxt on its own works fine, its when its combined with a library. I’ve tried this on my Linux, two Windows 10 and two Mac Mini’s (Intel and M1). They all exhibit the same issue. I did add a docker instance but its not working at the moment.
I solved the problem in my case just by doing one thing (even if that sounds weird) :
I have same issue on a fresh Nuxt RC9. No extra packages just :
npx nuxi init nuxt-appnpm installnpm run devI tried yarn too
Same issue, only removed the the node_modules folder and changed to “nuxt”: “3.0.0-rc.8” in the package.json. And it works back again 😃
im creating brand new project with npx nuxi init <Project-name> and when i run npm run dev same problem happen. Im on mac