vue2安装npm install vue-router报错原因分析和解决办法

目录

  • 分析原因
  • 解决办法

分析原因

peer vue@"^3.2.0" from [email protected]
默认安装是vue3版本的,需要指定版本安装

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   vue@"^2.6.11" from the root project
npm ERR!
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!

解决办法

这里指定了vue-router版本为3.2.0版本,正常安装成功

 npm install [email protected] -S

你可能感兴趣的:(前端,vue.js,前端,javascript)