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

The error message “error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree.” indicates that the current setup is missing the required dependencies for the @vitejs/plugin-vue plugin to work correctly.

In order to resolve this issue, you need to make sure that either Vue version 3.2.13 or above, or the @vue/compiler-sfc package is present in the dependency tree of your project.

Here are a couple of examples on how you can fix this issue:

Example 1: Installing Vue version 3.2.13

npm install vue@3.2.13

By running the above command, you will install Vue version 3.2.13 which satisfies the required version criteria for @vitejs/plugin-vue.

Example 2: Installing @vue/compiler-sfc

npm install @vue/compiler-sfc

Alternatively, you can install the @vue/compiler-sfc package which provides the necessary compiler for Single-File Components (SFCs) used by Vue. This package is compatible with the @vitejs/plugin-vue.

After installing either Vue version 3.2.13 or @vue/compiler-sfc, you should no longer encounter the mentioned error and the @vitejs/plugin-vue plugin will be able to function properly in your project.

Read more

Leave a comment