[RC 9] [RC 10] `Cannot read properties of undefined (reading 'modules')` when `vue` is installed in parent dir
See original GitHub issueRelated issues
- #7532
- #7220
- #7573
- https://github.com/nuxt/framework/issues/7564
- sidestream-tech/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 #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.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top GitHub Comments
@theolavaux It can be solved by modifying the package.json of each package as follows.
sample https://github.com/l4dybird/nuxt3-monorepo
i had this issue even with 3.0.0-rc.11-27722816.abd0feb, node_modules removed from project and parent dir as well adding legacy devBunder to nuxt.config.ts.
At the end, removing the yarn.lock file fixed the issue for me.
Linux
v16.13.1
3.0.0-rc.11-27722816.abd0feb
0.5.4-27719614.c3af02d
yarn@1.21.1
vite
buildModules
,publicRuntimeConfig
-
nuxt-windicss@2.5.2