npm install 异常“While resolving: [email protected]

最近一个项目,基本完成了,现在要融入别人项目里面才行,然后看了别人的项目之后无语了,跟前几年开始用vue3的时候的有个版本类似,vue2和vue3的混编,还是满亲切的,回家看了下发现这版本笔之前的还低,"element-plus": "1.0.2-beta.41",拿着人家的package.json,修改了自己项目的dependencies,一运行就出现下面的错误:

vue npm install

While resolving: [email protected]
Found: [email protected]
node_modules/vue
  vue@"^3.0.0" from the root project

Could not resolve dependency:
peer vue@"^2.5.17" from [email protected]
node_modules/element-ui
  element-ui@"^2.15.1" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

解决下载时候产生的依赖冲突

npm install --legacy-peer-deps

legacy的意思:遗产/(软件或硬件)已过时但因使用范围广而难以替代的;而npm install xxxx --legacy-peer-deps命令用于绕过peerDependency里依赖的自动安装;它告诉npm忽略项目中引入的各个依赖模块之间依赖相同但版本不同的问题,以npm v3-v6的方式去继续执行安装操作。所以其实该命令并没有真的解决冲突,而是忽略了冲突,以“过时”(v3-v6)的方式进行下载操作

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