Vue2项目安装Bootstrap与Bootstrap-Vue时Peer依赖冲突求助
Vue2项目安装Bootstrap-Vue时ESLint版本冲突的解决办法
方案一:降级eslint-plugin-vue至兼容版本
- 卸载当前高版本的eslint-plugin-vue:
npm uninstall eslint-plugin-vue - 安装@vue/eslint-config-standard@6.1.0要求的7.x版本:
npm install eslint-plugin-vue@^7.20.0 --save-dev - 重新安装Bootstrap和Bootstrap-Vue:
npm install bootstrap bootstrap-vue
方案二:使用npm旧版依赖解析逻辑绕过冲突
直接添加--legacy-peer-deps参数执行安装,该参数会忽略peer依赖版本检查,沿用npm v6及之前的依赖解析规则:
npm install bootstrap bootstrap-vue --legacy-peer-deps
方案三:手动修改依赖配置后重装
- 打开项目根目录的
package.json,找到devDependencies中的eslint-plugin-vue,将版本号修改为^7.0.0 - 删除项目根目录的
node_modules文件夹和package-lock.json文件 - 执行全量依赖重装:
npm install - 再次安装Bootstrap和Bootstrap-Vue:
npm install bootstrap bootstrap-vue
验证步骤
安装完成后,执行以下命令确认问题解决:
- 检查ESLint是否正常工作:
npm run lint - 启动项目验证功能:
npm run serve
内容的提问来源于stack exchange,提问作者Martin Huus Bjerge
相关产品推荐
相关产品推荐

