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

Foreword:

After using vue create to create the project , the following error is reported through npm run serve ;

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

Then follow the error prompts and perform npm install '@vue/compiler-sfc' --save-dev ; do it again after the installation is complete.

npm run serve still reports the above error .

Start looking for differences:

Comparing the normal projects built before, I found the differences: (start to try to solve the problem according to your own ideas)

 1. Execute npm uninstall vue to uninstall vue dependency packages in abnormal projects

 2. Then execute  npm install [email protected] --save-dev  to install the vue dependency package into the devDependencies dependency tree.

 3. Execute npm run serve  again

  ^_^ Project started successfully! ! !

Guess you like

Origin blog.csdn.net/m0_73334325/article/details/132365507