Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree.

To resolve the error @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree., you need to ensure that either Vue version 3.2.13 or later is installed or the @vue/compiler-sfc package is included in your project’s dependencies.

Here’s an example of how you can update your project to fix this error:

  1. Open your project’s package.json file.
  2. Check the version of Vue listed in the dependencies or devDependencies section. Make sure it meets the requirement of being equal to or greater than version 3.2.13. If not, update the Vue package to the required version. For example:
    {
      "dependencies": {
        "vue": "^3.2.13"
      }
    }
  3. If your project already has an older version of Vue installed, run the following command in your project’s root directory to update Vue:
    npm install vue@^3.2.13

    or if you’re using Yarn:

    yarn add vue@^3.2.13
  4. If you’re already using Vue version 3.2.13 or later, check if the @vue/compiler-sfc package is present in your project’s dependencies. If not, add it as a dependency using the following command:
    npm install @vue/compiler-sfc

    or with Yarn:

    yarn add @vue/compiler-sfc
  5. Once the necessary changes are made, restart your development server and the error should be resolved.

By ensuring that Vue version 3.2.13 or later is installed and the @vue/compiler-sfc package is included, you should be able to use the @vitejs/plugin-vue without any issues.

Read more interesting post

Leave a comment