安装vue-router时提示Could not resolve dependency

npm ERR! Could not resolve dependency:

npm ERR! peer vue@"^3.2.0" from [email protected]

npm ERR! node_modules/vue-router

npm ERR!   vue-router@"*" from the root project

npm ERR!

npm ERR! Fix the upstream dependency conflict, or retry

npm ERR! this command with --force, or --legacy-peer-deps

npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

npm ERR!

npm ERR! See C:\Users\26347\AppData\Local\npm-cache\eresolve-report.txt for a full report.



npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\26347\AppData\Local\npm-cache\_logs\2022-06-22T03_41_05_226Z-debug-0.log

解决办法是安装命令改为 npm install --save vue-router@3

vue2中使用的vue-router是3版本,同理vue3中安装4版本的vue-router 作者:头抹油酱 https://www.bilibili.com/read/cv17217353/ 出处:bilibili

你可能感兴趣的:(vue,vue.js,npm)