Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree.
时间: 2023-10-25 15:30:11 浏览: 54
这个错误提示是在使用 Vite 构建 Vue 项目时出现的,它表示 Vite 插件 @vitejs/plugin-vue 需要依赖 vue (>=3.2.13) 或 @vue/compiler-sfc,但是在你的项目依赖中找不到它们。解决这个问题的方法是在你的项目中安装 vue 或 @vue/compiler-sfc,可以使用以下命令:
```
npm install vue@3.2.13
```
或者
```
npm install @vue/compiler-sfc
```
安装完成后,再次运行构建命令即可。
相关问题
@vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree
这个错误提示是因为使用了 @vitejs/plugin-vue 插件,但是你的项目中没有安装 vue 或者 @vue/compiler-sfc。你需要在项目中安装其中一个依赖才能正常使用该插件。
如果你使用的是 Vue 3.x 版本,可以安装最新版本的 vue:
```
npm install vue
```
如果你使用的是 Vue 2.x 版本,需要安装 @vue/compiler-sfc:
```
npm install @vue/compiler-sfc
```
ERROR Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree.
这个错误提示是因为你使用的 Vite 插件 @vitejs/plugin-vue 需要依赖 Vue 3.2.13 或者 @vue/compiler-sfc,但是你的项目中没有安装它们中的任何一个。你需要在项目中安装它们来解决这个问题。你可以使用以下命令来安装最新版本的 Vue:
```
npm install vue@latest --save
```
或者安装 @vue/compiler-sfc:
```
npm install @vue/compiler-sfc --save-dev
```
安装完成后,重新运行你的项目即可。