Cannot start nuxt: Cannot find module '@nuxt/vite-builder'
Environment
Nuxt CLI v3.0.0-rc.6
RootDir: C:\Users\Ilya\Desktop\nuxt-app
Nuxt project info:
- Operating System:
Windows_NT - Node Version:
v16.15.0 - Nuxt Version:
3.0.0-rc.6 - Package Manager:
[email protected] - Builder:
vite - User Config:
ssr,bridge,buildModules,css,windicss,build - Runtime Modules:
- - Build Modules:
[email protected]
Reproduction
https://github.com/loremru/nuxt-bug
Describe the bug
ERROR Cannot start nuxt: Cannot find module '@nuxt/vite-builder'
Require stack:
- C:\Users\Ilya\Desktop\nuxt-app\index.js

Additional context
on majestic-ui version 0.0.83-13 its ok. But on latest versions there are nothing changed, only yarn version. Also latest versions works on clear vite.js
Logs
No response
Just curious, what happens if you add the @nuxt/vite-builder module?
I got another error so I stopped trying fixing this myself because I could not find the root cause🤷
Please remove nuxt-vite dependency (it is for Nuxt 20, node_modules and yarn.lock.
Also as workaround, as @HarmNullix mentioned, directly add @nuxt/vite-builder dependency and reinstall with yarn install. It should fix the problem.
This is a strange behavior of yarn only with some dependencies hoisting @nuxt/vite-builder to node_modules/nuxt/node_modules/@nuxt/vite-builder (which is inaccessible from node_modules/@nuxt/kit).
Please remove
nuxt-vitedependency (it is for Nuxt 20,node_modulesandyarn.lock. Also as workaround, as @HarmNullix mentioned, directly add@nuxt/vite-builderdependency and reinstall withyarn install. It should fix the problem.This is a strange behavior of yarn only with some dependencies hoisting
@nuxt/vite-buildertonode_modules/nuxt/node_modules/@nuxt/vite-builder(which is inaccessible fromnode_modules/@nuxt/kit).
After all manipulations I got another error as @HarmNullix said:
[h3] [unhandled] H3Error: document is not defined

Hmm, I'm afraid this issue is not related to yarn. Seems one of the dependencies you are using is not compatible with server-side rendering. Would you mind to update your repo or create a branch with dependency fix? Would be happy to help investigating that :)
Hmm, I'm afraid this issue is not related to yarn. Seems one of the dependencies you are using is not compatible with server-side rendering. Would you mind to update your repo or create a branch with dependency fix? Would be happy to help investigating that :)
https://github.com/loremru/nuxt-bug/tree/try-to-fix
Is there any news? @pi0
its a vue bug project and majestic-ui were need to update vue/vite packages
Reopening because there is something we can improve within Nuxt. @nuxt/vite-builder is being imported from rootDir (https://github.com/nuxt/framework/blob/ff924468ea22258685a37c19f64fcc694d01c959/packages/nuxt/src/core/builder.ts#L60) while we shall include parent nuxt package into the search path to handle situations when package manager decides to not hoist the dependency.