Skip to content

[RC 9] [RC 10] Cannot read properties of undefined (reading 'modules') when vue is installed in parent dir #14952

@pi0

Description

@pi0

Related issues

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions