You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 17:57:39