N
Nuxt2w ago
svecs132

Nuxt prepare error

In the last few days I can't create a nuxt app (using nuxi init) without getting this error during nuxt prepare after installing the dependencies (or subsequently after every npm i):
> nuxt prepare


ERROR loadNuxt2 is not a function

at loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2680:22)
at async Object.run (node_modules/@nuxt/cli/dist/chunks/prepare.mjs:31:18)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)



ERROR loadNuxt2 is not a function
> nuxt prepare


ERROR loadNuxt2 is not a function

at loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2680:22)
at async Object.run (node_modules/@nuxt/cli/dist/chunks/prepare.mjs:31:18)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)



ERROR loadNuxt2 is not a function
Does anyone know how I could fix that? (I mean I can remove the postinstall script that runs nuxt prepare but any other solutions?)
6 Replies
kapa.ai
kapa.ai2w ago
Hi @svecs132. 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 provided, I don't have specific information about the exact error you're encountering. However, there are a few relevant points that might help: 1. There have been recent issues with dependency versions in Nuxt, particularly with the db0 package. This was causing errors during initialization and preparation of Nuxt projects. Github Issue (closed): Broken init 2. The issue with db0 has been fixed in its latest version. As suggested by a Nuxt team member, upgrading your dependencies and lock file might resolve the problem. Github Issue (closed): Broken init 3. In some cases, users have reported that removing global installations of Nuxt-related packages and reinstalling dependencies in the project folder has helped resolve similar issues. Github Issue (closed): WARN [nuxt] Expected @nuxt/kit @nuxt/schema Given this information, here are some steps you could try: 1. Update all your Nuxt-related dependencies to their latest versions. 2. Delete your node_modules folder and package-lock.json (or equivalent for your package manager), then reinstall dependencies. 3. If you have any global installations of Nuxt or related packages, consider removing them and relying only on local project dependencies. 4. If the issue persists, you might want to check if there are any conflicting versions of Nuxt-related packages in your project. If these steps don't resolve the issue, you might want to report this specific error to the Nuxt GitHub repository, as it seems to be a new issue not covered in the provided knowledge sources. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@497916206343258112> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
svecs132
svecs132OP2w ago
Here's the complete log (with replaced directory names)
svecs132
svecs132OP2w ago
And here's the output of npx nuxi info from the directory
------------------------------
- Operating System: `Linux`
- Node Version: `v22.14.0`
- Nuxt Version: `1.4.5`
- CLI Version: `3.22.2`
- Nitro Version: `2.10.4`
- Package Manager: `[email protected]`
- Builder: `-`
- User Config: `compatibilityDate`, `devtools`
- Runtime Modules: `-`
- Build Modules: `-`
------------------------------
------------------------------
- Operating System: `Linux`
- Node Version: `v22.14.0`
- Nuxt Version: `1.4.5`
- CLI Version: `3.22.2`
- Nitro Version: `2.10.4`
- Package Manager: `[email protected]`
- Builder: `-`
- User Config: `compatibilityDate`, `devtools`
- Runtime Modules: `-`
- Build Modules: `-`
------------------------------
Cue
Cue2w ago
Nuxt 1.4.5? How’s that possible then 😂 Try npx nuxi@latest init
svecs132
svecs132OP2w ago
WHAT i ran it with @latest like 10 times and i always got the same error but now it works

Did you find this page helpful?