-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[RC 9] [RC 10] Cannot read properties of undefined (reading 'modules') when vue is installed in parent dir #14952
Description
Related issues
- __vite_ssr_import_2__.createMemoryHistory is not a function on RC.9 RC.10 #14907
- Cannot read properties of undefined (reading 'modules') #14802
- Cannot start application, Nuxt loading node modules from incorrect directory #14928
- Unable to start #14923
- Nuxt server error on 'npm run dev' sidebase/sidebase#16
Reproduction
Minimal reproduction: https://stackblitz.com/edit/github-2yn1ze?file=app%2Fpackage.json,app%2Fnuxt.config.ts
Describe the bug
How it happens: If vue dependency is installed outside of project directory in an adjutant directory (usually home directory with node_modules), vite-node that is enabled by default for RC.9+ makes issues. (issue is with nuxt custom external options)
Additional context
Workaround 1
Try switching to the edge channel. It should have been solved with nuxt/framework#7612.
Workaround 2
Check your home directory. If there is any node_modules dir, remove it or rename it. It is probably created wrongly in the past.
Workaround 3
It might be also because of a monorepo setup that has ../node_modules/vue dependency. In this case, switch to the legacy vite bundler:
export default defineNuxtConfig({
vite: {
devBundler: 'legacy',
},
});Remarks
The root cause of this issue is having multiple instances of vue in externals. In the future similar issue might happen with different causes as vue does not support multiple version instances.