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

前言:

使用vue create 创建项目后,通过npm run serve 报以下错误;

 错误:@vitejs/plugin-vue需要vue(>=3.2.13)或@vue/compiler-sfc存在于依赖树中。

然后按照错误提示进行了 npm install '@vue/compiler-sfc' --save-dev ;安装完毕后再次进行

npm run serve 还是报以上错误

开始找不同:

对比之前搭建的正常项目,发现不同点:(开始按照自己的想法尝试解决问题)

 1、执行 npm uninstall vue 卸载非正常项目中的vue依赖包

 2、再执行 npm install [email protected] --save-dev 把vue依赖包安装至devDependencies依赖树下

 3、再次执行npm run serve 

  ^_^ 项目启动成功!!!

猜你喜欢

转载自blog.csdn.net/m0_73334325/article/details/132365507