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

The error message you are seeing indicates that the @vitejs/plugin-vue plugin requires either vue (version 3.2.13 or above) or @vue/compiler-sfc to be installed as a dependency in your project.

To resolve this issue, you need to ensure that either vue (version 3.2.13 or above) or @vue/compiler-sfc is present in your project’s dependency tree.

Example 1: Installing vue

npm install vue

By running the above command, you will install the latest version of Vue.js as a dependency in your project. Make sure to check the installed version to ensure it meets the requirement mentioned in the error message.

Example 2: Installing @vue/compiler-sfc

npm install @vue/compiler-sfc

If you prefer using the @vue/compiler-sfc package instead, you can install it as shown above.

After installing the required dependencies, make sure to rebuild/restart your project to apply the changes. The error should no longer occur.

Read more

Leave a comment